Monday, February 14, 2011

Add Columns with Default value in a Table in SQL SERVER 2008

We Have atable named "User_General_Info" . Then If we need to Add a column to the table with a default date(e,g, System Date) then we can write in this way....

ALTER TABLE [User_General_Info]

ADD Reg_Date datetime

CONSTRAINT DF_User_General_Info_Reg_Date DEFAULT (getdate()) NOT NULL