Add column, with default value, to existing table in SQL Server

Total Post:128

Points:898

 2330  View(s)
Ratings:
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! 
  1. Re: Add column, with default value, to existing table in SQL Server

    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

Answer

Please check, If you want to make this post sponsored

You are not a Sponsored Member. Click Here to Subscribe the Membership.