SQL SERVER – ADD/DROP A COLUMN IN A TABLE

How to add and drop a column to a table in SQL SERVER? This is a simple Post and it may help beginners in SQL Server.

  • Add a Column

 ALTER TABLE [TableName] ADD [ColumnName] [DATATYPE]

ALTER TABLE mainschema.testtable ADD [State] INT

  • Drop a Column

ALTER TABLE [TableName] DROP COLUMN [ColumnName]

ALTER TABLE mainschema.testtable DROP COLUMN [State] 

     
print

3 thoughts on “SQL SERVER – ADD/DROP A COLUMN IN A TABLE

  1. Author’s gravatar

    Good varun…Helpfull for beginers

  2. Author’s gravatar

    Hi Varun,
    This is a gud post especially for beginners like me.

  3. Author’s gravatar

    Dear VArun,

    Can u pls update blog with some interview questions.This may usefull for many ppls.

Leave a Reply

Your email address will not be published. Required fields are marked *


+ 3 = eleven