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.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Concat 2 Columns in One

Author  Topic 

Rheinhardt
Yak Posting Veteran

66 Posts

Posted - 2009-04-06 : 08:49:35
Hi,

I am trying to join data from two columns into 1 column:

Cola Colb
100 Peter

...to read "100-Peter"

Please assist as SQL 2005 does not recognize the function CONCAT.

Thanks

asgast
Posting Yak Master

149 Posts

Posted - 2009-04-06 : 08:51:26
SELECT cola + colb FROM ....
all the columns must have varchar type
Go to Top of Page

ayamas
Aged Yak Warrior

552 Posts

Posted - 2009-04-06 : 08:52:14
Select Cola + '-' + Colb if Cola is varchar else Convert(Cola,varchar(20)) + '-' + Colb
Go to Top of Page

Rheinhardt
Yak Posting Veteran

66 Posts

Posted - 2009-04-06 : 09:12:18
Thanks
Go to Top of Page
   

- Advertisement -