Quick Question on appending to a text data type in SQL Server
Posted on 2006-06-18
It is my understanding that you cannot directly append to a text data type (since you get an error). I have tried a number of things without success. I need to append a string to a text data type without getting a bunch of spaces at the end. It would be preferable if the returned value was of type text, but it's not necessary.
This is one of the statements I've been working on, but it doesn't work:
select '(OLD) ' + convert(char(datalength(itemname)+6), itemname) from items where id = 30
Note that itemname is of type text and that, even if this did work, it wouldn't return a text data type (although, again, this is not necessary - just preferable)