[dba-SQLServer] Re: Convert from ntext to varchar

Robert L. Stewart rl_stewart at highstream.net
Sun Jun 12 16:59:30 CDT 2005


Steve,

Try converting nText to Text.  You are essentially taking a very large 
field and trying to reduce it to 16 characters with the varchar size you 
are using.  You might check out UPDATETEXT in the books on line.


Robert

At 12:00 PM 6/11/2005, you wrote:
>Date: Sat, 11 Jun 2005 09:20:49 +1000
>From: "Adam Cogan www.ssw.com.au" <adamcogan at ssw.com.au>
>Subject: RE: [dba-SQLServer] Convert from ntext to varchar
>To: "Steven W. Erbach" <serbach at new.rr.com>
>Cc: dba-sqlserver at databaseadvisors.com
>Message-ID:
>         <E744242B5FBBEB4180BE40EE5F46AD61179F2B at cow.sydney.ssw.com.au>
>Content-Type: text/plain;       charset="us-ascii"
>
>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





More information about the dba-SQLServer mailing list