Saturday, February 20, 2010

Add Delete modify the Column in Database

Before Add the Column in the table need to check column already exists or not

If Not Exists(select * from sys.columns where Name = N'ArabicName' and Object_ID = Object_ID(N'Branch'))
Alter Table [Branch] Add ArabicName nvarchar(500)

Drop the Coloumn from the table

ALTER TABLE tbl1 Drop Column abcd;

Modify the coulmn size from the existing table
ALTER TABLE tbl1 Alter Column abcd nvarchar(4000) not null;