concatenate two database columns into one resultset column

后端 未结 7 2073
独厮守ぢ
独厮守ぢ 2020-11-28 10:00

I use the following SQL to concatenate several database columns from one table into one column in the result set:

SELECT (field1 + \'\' + field2 + \'\' + field

相关标签:
7条回答
  • 2020-11-28 10:32

    Just Cast Column As Varchar(Size)

    If both Column are numeric then use code below.

    Example:

    Select (Cast(Col1 as Varchar(20)) + '-' + Cast(Col2 as Varchar(20))) As Col3 from Table
    

    What will be the size of col3 it will be 40 or something else

    0 讨论(0)
提交回复
热议问题