"Warn on null primary keys" table design option in SSMS
I SSMS (2008R2) menu Tools --> Options --> Designers --> Table and Database Designers --> "Warn on null primary keys" I played checking and unchecking this checkbox but could not detect the differences.
What is it for?My related questions, probably:
- NULL permitted in Primary Key - why and in which DBMS?
- 开发者_开发知识库Why to use “not null primary key” in TSQL?
OK, it would seem that when this is checked, if any of the columns are nullable, it will produce a warning stating
Primary Key cannot be created on Column 'X' because it allows null values.
Clear the Allow Nulls check box for each column in the primary key.
Whereas if this is not check, and you make columns the primary key, they will automatically be changed to non nullable.
精彩评论