Sign in with Microsoft
Sign in or create an account.
Hello,
Select a different account.
You have multiple accounts
Choose the account you want to sign in with.

Summary

An update is available that introduces a new Transact-SQL statement, CREATE OR ALTER. This statement performs an internal check for an object's existence. If the object does not exist, a new object will be created. If the object exists, the existing object will be altered to the new definition. The new Transact-SQL statement code example resembles the following:

CREATE OR ALTER VIEW corView AS
SELECT 2 AS [dos];
GO


More Information

This update is included in Service Pack 1 for SQL Server 2016.

Each new build for SQL Server 2016 contains all the hotfixes and all the security fixes that were included with the previous build. We recommend that you install the latest build for SQL Server 2016.


Before you apply this update and you alter the definition of programmability objects, you have to perform the following operations:

  • Drop the object (if it exists)

  • Create the object by using the new definition

  • Restore permissions for the object


Or, perform the following operations:

  • If the object does not exist, create the object by using CREATE statement.

  • Otherwise, alter the object by using a separate ALTER statement.


After you apply this update, you can only execute the CREATE OR ALTER statement on the following programmability objects:

  • Views

  • Stored procedures (including natively compiled)

  • User-defined functions (including natively compiled)

  • Triggers (including natively compiled)


The CREATE OR ALTER statement does not apply to the following:

  • Objects that require storage (tables, indexes, indexed views, and so on)

  • Non-programmability objects (such as CREATE ASSEMBLY, CREATE TABLE or CREATE SCHEMA)

  • Deprecated programmability objects (RULE and DEFAULT)

Note CLR user-defined functions are supported starting with SQL Server 2016 SP1 CU1.

References

Learn about the terminology that Microsoft uses to describe software updates.

Need more help?

Want more options?

Explore subscription benefits, browse training courses, learn how to secure your device, and more.

Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.

Was this information helpful?

What affected your experience?
By pressing submit, your feedback will be used to improve Microsoft products and services. Your IT admin will be able to collect this data. Privacy Statement.

Thank you for your feedback!

×