Dec 8, 2010

sql Modify Table

Modifying Table :-

After creation of a table you can change table like that  :-

Add columns.
Modified columns.
Delete columns.

Syntax :
           ALTER TABLE <table_name>


           ALTER COLUMN <column_name> <new_data_type>
           ADD [column_name <Data_type>]

           DROP COLUMN <column_name>

Example

Add a new column is student table :-

Alter Table FLIGHT_MASTER

Add  country nvarchar(50)

Execute Command  :

Result :

Command(s) completed successfully.

A New column has been add in Table student.

DROP COLUMN
ALTER TABLE  FLIGHT_MASTER
Drop Column Country

Country column has been dropped from FLIGHT_MASTER Table. 

No comments:

Post a Comment