Wednesday, December 12, 2012


Add new COLUMN in table in sql server(2005,2008) :
How to Add new COLUMN in table (Sql server)

Approach  1:
To Add a new Column in table use below query:

ALTER TABLE Tblresult  ADD marks int null DEFAULT (0)

Approach 2:
To Add a identity column or primary key column   in table we can use below query:

ALTER TABLE Tblresult  ADD StudentID int not null IDENTITY(1,1)

Here  StudentID coloumn will have a incremental value 1.StudentID value start with 1 and for every new row the valur will increase by 1.For 1st Student id will 1 then for second student record it will be 2.


No comments:

Post a Comment