Monday, December 3, 2007

How to alter table to add a new column with T-SQL

How to alter table to add a new column with T-SQL

Step 1

Altering table can be done by using ALTER TABLE command. The command below will add a new column into your EMPLOYEE table with a datatype varchar and size 20.

USE DEMO

ALTER TABLE EMPLOYEE ADD CREDITCARD VARCHAR(20)

Step 2

Switch to SQL Analyzer and then enter the following command before pressing F5.

Your table will have a new column called CreditCard.

No comments: