Quantcast
Channel: CodeSection,代码区,SQL Server(mssql)数据库 技术分享 - CodeSec
Viewing all articles
Browse latest Browse all 3160

CREATE OR ALTER in SQL Server

$
0
0

One of my colleague was asking a follow up question on my earlier post DROP IF EXISTS A handy feature in SQL Server 2016

Do we have something similar for Creating objects?

The good news is that we have “CREATE or ALTER” in SQL Server 2016 to address our long waiting requirement. However, this will not be available in RTM, but only from SP1 and above.

Applies to : SQL Server 2016 SP1 or later versions

Here is a small script to verify the same.

SQL Script:

--Creating the procedure first time CREATE OR ALTER PROCEDURE SP_TEST AS BEGIN SELECT 2 END GO EXEC SP_TEST GO --Altering the procedure CREATE OR ALTER PROCEDURE SP_TEST AS BEGIN SELECT 200 END GO EXEC SP_TEST
CREATE OR ALTER in SQL Server

Note: This can also be used for Function objects to create or alter operations.


Viewing all articles
Browse latest Browse all 3160

Trending Articles