ADD AND ALTER COLUMN IN A TABLE SCRIPT
---ALTER FOR COLUMN NAME NAME AND SIZE---
IF EXISTS( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'CollegeInfo'
AND COLUMN_NAME = 'CollegeName')
BEGIN
ALTER TABLE CollegeInfo ALTER COLUMN CollegeName VARCHAR(200) NOT NULL
END
------ADD FOR COLUMN -------
IF NOT EXISTS( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'CollegeInfo'
AND COLUMN_NAME = 'CollegeName')
BEGIN
ALTER TABLE CollegeInfo ADD COLUMN CollegeName VARCHAR(200) NOT NULL
END
IF EXISTS( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'CollegeInfo'
AND COLUMN_NAME = 'CollegeName')
BEGIN
ALTER TABLE CollegeInfo ALTER COLUMN CollegeName VARCHAR(200) NOT NULL
END
------ADD FOR COLUMN -------
IF NOT EXISTS( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'CollegeInfo'
AND COLUMN_NAME = 'CollegeName')
BEGIN
ALTER TABLE CollegeInfo ADD COLUMN CollegeName VARCHAR(200) NOT NULL
END