November 10, 2015

SQL SERVER 2016 FEATURES

SQL Server 2016 introduces the new statement because it is very confusing when you need to check an object either it is present or not.

Previously when we need to check the Store procedure either it is exists or not we use following long lengthy syntax:


IF OBJECTPROPERTY(object_id('dbo.sp_GenerateReport'), N'IsProcedure') = 1
DROP PROCEDURE [dbo].[sp_GenerateReport]
GO

Now in the latest version of SQL Server, they reduce the long lengthy statements into one line for Store procedure, function and tables. They named the statement as 'DIE' => DROP IF EXISTS


DROP FUNCTION IF EXISTS fn_CalculateSum
DROP PROCEDURE IF EXISTS sp_GenerateReport
DROP TABLE IF EXISTS Subscriber

See that!!! this is so simple to remember and use in your daily routine queries.

Cheers