Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
Eagle_f90
Constraint Violating Yak Guru
424 Posts |
Posted - 2012-05-23 : 17:39:09
|
| Is it possible to create a select statement that grabs the data out of two columns and returns that data as a single column? I.E Select Column1 + Column2 AS CombindedColumn form dbo.Table?-- If I get used to envying others...Those things about my self I pride will slowly fade away.-Stellvia |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2012-05-23 : 17:43:11
|
| Yes, that's exactly how you'd do it, as long as they are both character data types, or converted to such. |
 |
|
|
mani_12345
Starting Member
35 Posts |
Posted - 2012-05-24 : 00:47:21
|
| yes u can do it ...select convert(varchar([size]),[col_name],1) +space(1)+ convert(varchar([size]),[col_name2],1)try this...u vl get answer |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-05-24 : 15:41:17
|
| make sure you add check for NULLs and convert them to blanks or some default value if any of columns are nullable. Otherwise the concatenation causes result to be NULL if any of columns have NULL values under default conditions------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|