Pages

Tuesday, January 18, 2011

ALTER

ALTER

--===================[ALTER]============================================================
--ALTER is used to add or delete new columns to the existing table or to change the datatypes

-- Adds the column telephone_no to the employee table.
ALTER TABLE employee
ADD telephone_no CHAR(12) NULL
SELECT * FROM employee

--chnage the datatype of the column telephone_no
ALTER TABLE employee
ADD telephone_no NVARCHAR(15)
SELECT * FROM employee

--deletes the column telephone_no
ALTER TABLE employee
DROP telephone_no
SELECT * FROM employee

No comments:

Post a Comment