Wednesday, March 7, 2012

Alter Column Set Default

I've done some research on setting the default value of a column and found the following code:

ALTER TABLE [table1] ALTER COLUMN [column1] SET DEFAULT 0

I am trying to set column1 within table1 to a default value of 0, column1 is an int data type. But it doesn't work within MS SQL SERVER 2000.

Can anyone tell me what's wrong?what you want is this:

ALTER TABLE table1
ADD CONSTRAINT DF_table1_column1
DEFAULT 0 FOR column1|||Thanks very much! It's appreciated.

No comments:

Post a Comment