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

Query to change the datatype of column in sql server

Jul 8, 2012

In this article I will explain how to change or rename datatype of column in SQL server.


In previous post I explained how to alter or modify or delete or change already existing column in datatable in SQL Server and many articles relating to SQL Server. Now I will explain how to rename or change datatype of column name or table name in SQL Server.

Syntax 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 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,, 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


Alex Peta said...

Does this work even if the column is populated with data? I dont think so. The right way to do this is to create a new aux column, copy the original data there, empty the target column with nulls, alter it, and the copy back data from aux to target.

Edi Prakoso said...

hai suresh, what is the different between nvarchar and varchar?

Suresh Dasari said...

@Edi Prakoso....
check this post

Give your Valuable Comments

Note: Only a member of this blog may post a comment.

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