November 8, 2002 at 5:39 am
I know that "null" is the default if you don't specify anything on the "nullable" option when creating a column. Is it possible to change this to "not null"? Most of the columns in my table are "not null"-able so this will save me a lot of typing.
"The way to get things done is not to mind who gets the credit for doing them." - Benjamin Howett
November 8, 2002 at 6:07 am
Not as default, no. You have to specify NOT NULL. Would be a nice feature thou. Might send a feature request to MS.
November 8, 2002 at 8:05 am
Actually, you can change the default to be NOT NULL. It is in BOL:
quote:
If any database settings are configured (changed with sp_dboption), then:If ANSI null default is true, NULL is assigned.
If ANSI null default is false, NOT NULL is assigned.
When (neither of the ANSI_NULL_DFLT options is set) for the session and the database is set to the default (ANSI null default is false), then the SQL Server default of NOT NULL is assigned.
Hope that helps...
November 8, 2002 at 8:36 am
Cool I have now learned something new.
November 8, 2002 at 10:10 am
You need to look at ansi_null_default. You can set this at a database level but some clients overide this. You can override it to which ever way you want by using
SET ANSI_NULL_DFLT_ON ON|OFF
Simon Sabin
Co-author of SQL Server 2000 XML Distilled
http://www.amazon.co.uk/exec/obidos/ASIN/1904347088
Simon Sabin
SQL Server MVP
http://sqlblogcasts.com/blogs/simons
November 8, 2002 at 11:46 am
Thank you so much guys!
"The way to get things done is not to mind who gets the credit for doing them." - Benjamin Howett
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply