I have a table with a text column
I want to select that column and add some text to the result
e.g.
select textcolumn + 'Added Text' From xTable
but this fails because one can not use + or concat on text columns
i get around this by using cast as varchar(1024)
e.g.
select cast(textcolumn as varchar(1024)) + 'Added Text' From xTable
but this would cut the text column after 1024 chars
is there a way around this and not limiting the length of the text columnI'm at home and not a work at the moment so I can't check for sure (or rather I'm not going to), but can't you omit the length of the varchar in the cast statement??|||select cast(textcolumn as varchar) + 'Added Text' From xTable
or
select convert(varchar, textcolumn) + 'Added Text' From xTable
works for my SQL2000, otherwise, you can just trim out the trailing spaces|||Just be aware that the max length of varchar is 8000.
Originally posted by shianmiin
select cast(textcolumn as varchar) + 'Added Text' From xTable
or
select convert(varchar, textcolumn) + 'Added Text' From xTable
works for my SQL2000, otherwise, you can just trim out the trailing spaces
Showing posts with label resulte. Show all posts
Showing posts with label resulte. Show all posts
Subscribe to:
Posts (Atom)