Home > DeveloperSection > Forums > Add column, with default value, to existing table in SQL Server
Ashish Pandey

Total Post:128

Points:898
Posted on    April-17-2013 1:29 AM

 MSSQL Server MSSQL Server 
Ratings:


 1 Reply(s)
 1490  View(s)
Rate this:
Hi Everyone!

How do you add a column, with a default value, to an existing table in SQL Server 2000/2005?

Thanks in advance! 


AVADHESH PATEL

Total Post:604

Points:4228
Posted on    April-17-2013 8:57 AM

Hi Ashish!

You can try as below

ALTER TABLE {TABLENAME} 
ADD {COLUMNNAME} {TYPE} {NULL|NOT NULL} 
CONSTRAINT {CONSTRAINT_NAME} DEFAULT {DEFAULT_VALUE}

I hope it resolve your problem

Don't want to miss updates? Please click the below button!

Follow MindStick