Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 NOT NULL columns by default

Author  Topic 

rb1373
Yak Posting Veteran

93 Posts

Posted - 2005-04-14 : 16:12:17
What configuration do I need to have columns set to be NOT NULL by default? I tried setting "ANSI NULL default" under database options, but that didn't work. I've tried a myriad of conifugations, checked BOL and the forums but nothing is working.

Thanks,
Ray

Thrasymachus
Constraint Violating Yak Guru

483 Posts

Posted - 2005-04-14 : 16:16:29
What makes you think it is not working?

Sean Roussy
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2005-04-14 : 16:19:17
If you didn't specify this option when you created the table, then you'll need to use ALTER TABLE ALTER COLUMN...Check SQL Server Books Online for details.

Here's an example if you do it at create time:

CREATE TABLE SomeTable (Column1 int NOT NULL, Column2 varchar(20) NOT NULL, Column3 bit NULL)

Tara
Go to Top of Page

byrmol
Shed Building SQL Farmer

1591 Posts

Posted - 2005-04-14 : 16:55:58
Ray,

You are confusing the way SQL Server treats null (ANSI settings) versus the column definition (NOT NULL). By default, and this is unchangeable, the column will be set to allow nulls, unless you specifically say NOT NULL.

IMHO, it should be the other way around...

DavidM

A front-end is something that tries to violate a back-end.
Go to Top of Page

rb1373
Yak Posting Veteran

93 Posts

Posted - 2005-04-14 : 16:59:07
Yes I was confused. Thanks all!
Go to Top of Page

jason
Posting Yak Master

164 Posts

Posted - 2005-04-14 : 17:00:06
quote:
A front-end is something that tries to violate a back-end.


lmao byrmol

search timing out
Go to Top of Page
   

- Advertisement -