February 10, 2012 at 9:41 pm
When a data type is defined as NOT NULL, what happens when new rows are created? Will a new row not be created (e.g., throw an error) if data is attempted to be inserted in that column/value that was declared/defined as NOT NULL?
February 11, 2012 at 3:44 am
If data is specified to be inserted into the not null column then that's fine. I suspect you meant what happens if data is not specified for a not null column.
In that case..
Msg 515, Level 16, State 2, Line 1
Cannot insert the value NULL into column <column name>, table <table name>; column does not allow nulls. INSERT fails.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy