Aspdotnet-Suresh

aspdotnet-suresh offers C#.net articles and tutorials,csharp dot net,asp.net articles and tutorials,VB.NET Articles,Gridview articles,code examples of asp.net 2.0 /3.5,AJAX,SQL Server Articles,examples of .net technologies

SQL Server - How to Drop / Delete Column from Table in 2008

Mar 13, 2014
Introduction:

Here I will explain how to drop column in SQL Server or delete columns from table in SQL Server 2008.

Description:

In previous articles SQL Query to get list of tables in database, SQL add auto increment column to table, SQL Server ACID properties, SQL date diff function example  and many articles related to SQL Server. Now I will explain how to drop or delete columns from table SQL Server.

Query to Drop or delete column from existing table

If we want to drop column from existing table that syntax will be like this


ALTER TABLE Table_Name DROP COLUMN COLUMN_NAME
Ex:


ALTER TABLE emp_table DROP COLUMN Manager_Name
From the above query declaration column “Manager_Name” will drop from emp_table

Query to modify existing column datatype in table

If we want to modify existing column datatype from data table that syntax will be like this


ALTER TABLE Table_Name ALTER COLUMN COLUMN_NAME DATATYPE
Ex:


ALTER TABLE emp_table ALTER COLUMN Manager_Name nvarchar(max)

From the above query declaration I changed “Manager_Name” column datatype from VARCHAR(50) to nvarchar(max)

If you enjoyed this post, please support the blog below. It's FREE!

Get the latest Asp.net, C#.net, VB.NET, jQuery, Plugins & Code Snippets for FREE by subscribing to our Facebook, Twitter, RSS feed, or by email.

subscribe by rss Subscribe by RSS subscribe by email Subscribe by Email

1 comments :

chandana said...

kindly post an article for Collections in .net.

Give your Valuable Comments

Other Related Posts

© 2010-2012 Aspdotnet-Suresh.com. All Rights Reserved.
The content is copyrighted to Suresh Dasari and may not be reproduced on other websites without permission from the owner.