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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

string concatenation using "text" data type

Status
Not open for further replies.

ctwilliams

Programmer
Feb 15, 2002
86
US
I want to concatenate a text field with a varchar field. For example...

Code:
SELECT MyTextField + ' append some other text'
FROM MyTable

SQL Books Online says that the "+" (string concatenation) operator can be used with "any of the data types in the character and binary data type category, except the image, ntext, or text data types."

I tried CAST'ing the text field to a varchar type, but this causes the text to be truncated after a certain number of characters.

Is there some other way to do this?
 
Create a temp table, use updatetext to concatenate and select from that.
You might be able to do a similar thing in a function but would be slower.

======================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
 
Yep what nigel said makes sense to me.

Questions about posting. See faq183-874
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top