Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

TEXT concatenation

Status
Not open for further replies.

Technokrat

Programmer
Jul 20, 2001
92
US
I need to concatenate a TEXT datatype field from several rows, into one resulting output, and its fine for the output to be varchar (8000). How do I go about this?

I've tried creating a cursor, but the problem is that it won't let me create a local var of type TEXT. I want to trancate my results after concatenation, not truncate each piece first, and then concatenate.

Any thoughts???
 
Try declaring several Varchar(xxx) variables, then do a cast/convert on the text datatypes when you're pulling them in. Such as Cast(<textfield> AS Varchar(xxx)). Then concatenate them into your variable that you already declared as Varchar(8000).



Catadmin - MCDBA, MCSA
Beware the error of pre-emptive poultry inventory!
 
The problem with your suggested method is that it truncates the pieces before concatenation. I want to truncate the result after all items have been concatenated.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top