[dba-SQLServer] Convert from ntext to varchar

Adam Cogan www.ssw.com.au adamcogan at ssw.com.au
Fri Jun 10 18:20:49 CDT 2005


Steven

 

I always convert nChar to Char

                  nVarchar to Varchar

                  nText to Text

 

We use a tool to do this - SSW SQL Auditor www.ssw.com.au/SQLAuditor
<http://www.ssw.com.au/SQLAuditor>  

 

HTH

--Adam 

 

 

-----Original Message-----
From: dba-sqlserver-bounces at databaseadvisors.com
[mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of Steven
W. Erbach
Sent: Thursday, January 06, 2005 9:39 PM
To: dba-sqlserver at databaseadvisors.com
Subject: [dba-SQLServer] Convert from ntext to varchar

 

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

 

 

 

 

_______________________________________________

dba-SQLServer mailing list

dba-SQLServer at databaseadvisors.com

http://databaseadvisors.com/mailman/listinfo/dba-sqlserver

http://www.databaseadvisors.com

 




More information about the dba-SQLServer mailing list