Jeppe Stig Nielsen
Jeppe Stig Nielsen

Reputation: 61912

Why is this allowed: create database [MyExample] with compatibility_level = 100

In SQL Server, the following executes with no error:

create database [MyExample] with compatibility_level = 100;  -- runs! why?

It creates a database all right, but it does not set its compatibility level. Why is that syntax allowed then?

In contrast, if I do:

create database [MyExample] with nonsense_notexisting = 100;  -- fails :-)

then I get the error Incorrect syntax near 'nonsense_notexisting' as expected.

My question is: Why is the first syntax allowed if it does not set the compatibility level?


PS! I am not asking how to create a database with a particular compatibility. I know that is done with:

create database [MyExample]; alter database [MyExample] set compatibility_level = 100;

Upvotes: 1

Views: 71

Answers (0)

Related Questions