[dba-SQLServer] Convert from ntext to varchar

Steven W. Erbach serbach at new.rr.com
Thu Jan 6 04:38:56 CST 2005


Dear Group,

It seems that it might be a good idea to convert the ntext Comment columns I have in a number of tables to varchar, even though the maximum length is much less and there's no Unicode capability. The Comments in these tables aren't going to be book length.

I'm having trouble, though converting from ntext to varchar. The existing columns are all ntext 16. I've tried using a stored procedure like this:

CREATE PROCEDURE _spTmpConvertKeyStatsComment AS
UPDATE tblKeyStats
SET NewKeyStatsComment = CAST(KeyStatsComment AS varchar)

GO

In the tblKeyStats table I added a varchar 16 column named NewKeyStatsComments. As you can see I tried to use the CAST function. When I run this sproc in a SQL script, none of the data is copied into the NewKeyStatsComment column. I will say that some of the original KeyStatsComment values are NULL.

Any thoughts?
 
Regards,
 
Steve Erbach
Scientific Marketing
Neenah, WI







More information about the dba-SQLServer mailing list