Click here to Skip to main content
15,899,662 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have SQL Server database and I just realized that I can change the type from one of the columns from text to ntext. How can I do that without losing the data that is already entered into that table?

PS. I am using SQL Server Server 2008.
Posted
Comments
Gihan Liyanage 24-Sep-14 4:33am    
If you are using text, then you can simply change it to ntext.. No data will be change
zainab77 24-Sep-14 6:30am    
i did but sql didnt accept ??
Gihan Liyanage 24-Sep-14 6:42am    
What you have done ? You used any command or did using Management Studio? What you get as the error ?
Gihan Liyanage 24-Sep-14 6:51am    
See this article
http://support.microsoft.com/kb/196935
RossMW 24-Sep-14 5:46am    
As a side comment. If you are changing the type that will lose the data you can add a new field with the new data type and convert and copy the data to it, then delete the old and rename the new field.

Check this link for couple of advices.

SQL Server 2000 - How do I alter a column from text to ntext?[^]
 
Share this answer
 
Steps:
Sql server - Tools -> Options ->Designers ->

There You can find the Auto Generate Change Scripts which is unchecked,so make it as Check.

Uncheck the 
prevent saving Changes that requires Table re-Creation 

Save ->

Now open your table design and Change your datatype as text to ntext and Save it.

it will ask for Overwrite then go with Yes.
 
Share this answer
 
Alter Table TableName
Alter Column ColumnName YourDataType
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900