Add Column

Add New Column or Modify Existing Column

Open your table in Design and Add your column or Modify existing column and save it.





Using Script Add or modify the columns.
Lets add FacPhNo column to table tblFaculty

Alter table tblFaculty
Add FacPhNo int

If you want to add the column only if the table doesn't contain that column then use this script:

IF NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'tblFaculty' AND COLUMN_NAME = 'FacPhNo')
BEGIN
Alter table tblFaculty
Add FacPhNo int
END



No comments:

Post a Comment