Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 convert to string an ntext field

Author  Topic 

esthera
Master Smack Fu Yak Hacker

1410 Posts

Posted - 2009-02-11 : 14:03:13
i'm creating a string based on table data and I have

&comments=' +isnull( cast(comments as varchar),'')


but my problem is this truncates logn strings - how can I do this - comments is an ntext field and can be longer then a varchar.

please advise

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2009-02-11 : 14:06:01
quote:
Originally posted by esthera

i'm creating a string based on table data and I have

&comments=' +isnull( cast(comments as nvarchar(max)),'')


but my problem is this truncates logn strings - how can I do this - comments is an ntext field and can be longer then a varchar.

please advise

Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-02-11 : 17:02:14
DECLARE @Comments VARCHAR(MAX)

SET @Comments = COALESCE(CAST(Comments AS VARCHAR(MAX)), '')



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

esthera
Master Smack Fu Yak Hacker

1410 Posts

Posted - 2009-02-12 : 02:25:01
thanks
Go to Top of Page
   

- Advertisement -