Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase ««12

concatenate Expand / Collapse
Author
Message
Posted Tuesday, April 23, 2013 3:33 PM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Wednesday, August 20, 2014 1:25 PM
Points: 58, Visits: 220
ok thanks changing them to a varchar works now.
Post #1445703
Posted Tuesday, April 23, 2013 3:50 PM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 1:32 PM
Points: 13,295, Visits: 12,146
Mansfield (4/23/2013)
Text, ntext and image are special data types that does not support the normal string operators.
If you want to concatenate, you'll need to cast each field into varchar or nvarchar first.


And they have all been deprecated. Please consider changing your base tables to (n)varchar(max).

Of course I doubt you really need varchar(max) here because varchar can hold up to 8,000 characters. You can figure out how long your real data is with

select max(len(cast(YourTextColumn as varchar(max)))) as MaxLen



_______________________________________________________________

Need help? Help us help you.

Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

Need to split a string? Try Jeff Moden's splitter.

Cross Tabs and Pivots, Part 1 – Converting Rows to Columns
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs
Understanding and Using APPLY (Part 1)
Understanding and Using APPLY (Part 2)
Post #1445708
« Prev Topic | Next Topic »

Add to briefcase ««12

Permissions Expand / Collapse