I have 2 text data type columns that I would like to combine into a new column. I'd also like to add a newline character between each column value when I combine them.
I've tried columnA + columnB but that didn't work.
How could I do that?
Hi,
you can do it like this
select columnA + ' ' + columnB as columnAB from tableX
Grz, Kris.
|||Here's the error that it produces:
Msg 402, Level 16, State 1, Line 1
The data types text and varchar are incompatible in the add operator.
|||In that case you need to cast the varchar to type text. You can do that by using the Transact-SQL functionCAST.
Grz, Kris.
No comments:
Post a Comment