Adding more than one new columns to a table in single ALTER statement

Bandi
Posted by Bandi under Sql Server category on | Points: 40 | Views : 363
Sometimes, we will get the some database changes such as adding new columns to an exisitng table...

We can add as follows:
ALTER TABLE Employee ADD DeptID int
GO
ALTER TABLE Employee ADD DName varchar(20)
GO
ALTER TABLE Employee ADD Location varchar(30)
GO


Alternate to the above process is as follows:
We can simply add the new columns by using single ALTER TABLE statement...


ALTER TABLE Employee ADD DeptID int,DName varchar(20), Location varchar(30)

Comments or Responses

Login to post response