Explain the ALTER table statement in SQL Server.
The ALTER table statement is used to add, delete or modify the columns in a table.
Ex :
To ADD a column in a table,
ALTER TABLE Employees
ADD DateofBirth date
This Query will display a new column “DateofBirth” in date format to Employees table.
To DELETE a column in a table,
ALTER TABLE Employees
DROP column DateofBirth
This Query will delete the column “DateofBirth” from Employees table.
Ex :
To ADD a column in a table,
ALTER TABLE Employees
ADD DateofBirth date
This Query will display a new column “DateofBirth” in date format to Employees table.
To DELETE a column in a table,
ALTER TABLE Employees
DROP column DateofBirth
This Query will delete the column “DateofBirth” from Employees table.
1 Comments:
very nice post
dbakings
Post a Comment
Subscribe to Post Comments [Atom]
<< Home