Tags

, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,


NEW T-SQL FEATURES IN SQL SERVER 2016-I

In this post we shall check out the new features Microsoft introduced in SQL Server 2016.

New feature – 1 | DROP IF EXISTS

This is the new addition in T-SQL where you can drop the object using DROP IF EXISTS command. Also note that even if the object does not exists, the command will not fail and execution will continue. As of the now following objects can be dropped using DROP IF EXISTS command.

AGGREGATE
PROCEDURE
TABLE
ASSEMBLY
ROLE
TRIGGER
VIEW
RULE
TYPE
DATABASE
SCHEMA
USER
DEFAULT
SECURITY POLICY
VIEW
FUNCTION
SEQUENCE
INDEX
SYNONYM

Sample example for DROP DATABASE IF EXISTS

--

CREATE DATABASE testpawan
GO

--

Output

--

/*------------------------
CREATE DATABASE testpawan
GO

------------------------*/
                                    
--
--

DROP DATABASE IF EXISTS testpawan
GO

--

Output

--

/*------------------------
DROP DATABASE IF EXISTS testpawan
GO
------------------------*/
                                    
--

Refer for more details –

1.https://blogs.msdn.microsoft.com/sqlserverstorageengine/2015/11/03/drop-if-exists-new-thing-in-sql-server-2016/
2.https://docs.microsoft.com/en-us/sql/t-sql/statements/drop-table-transact-sql
3.https://docs.microsoft.com/en-us/sql/database-engine/whats-new-in-sql-server-2016

Enjoy !!! Keep Learning

Pawan Khowal 

Http://MSBISkills.com