I have a column:
ALTER TABLE dbo.bat_Batches ADD Version int NOT NULL CONSTRAINT DF_bat_Batches_Version DEFAULT 1
I now want to set the default to 2. I can do it thru Enterprise Manager, but what is the proper SQL DDL statement to change it?
Can you be more specific? I can't seem to find the right syntax. Have tried things like:
ALTER TABLE dbo.bat_Batches ALTER COLUMN Version int NOT NULL CONSTRAINT DF_bat_Batches_Version DEFAULT 2
ALTER TABLE dbo.bat_Batches ALTER COLUMN Version SET DEFAULT 2
and others. I can't seen to get the right format.
Oh! Got it now. Thanks, ramses2nd! Syntax is:
ALTER TABLE dbo.bat_Batches DROP CONSTRAINT DF_bat_Batches_Version;ALTER TABLE dbo.bat_Batches ADD CONSTRAINT DF_bat_Batches_Version DEFAULT 2 FOR Version;