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
 General SQL Server Forums
 New to SQL Server Programming
 how to concatenate two column value in one column

Author  Topic 

immad
Posting Yak Master

230 Posts

Posted - 2014-09-22 : 04:38:22
hi,

my data is like this

ID--Country----Code
1---ARGENTINA---10
2---AUSTRALIA---13
3---BELGIUM------21

i want this type of data

ID--Country
1---ARGENTINA+{10}
2---AUSTRALIA+{13}
3---BELGIUM+{21}

please help me out
thanks for the help

immad uddin ahmed

Arun Babu N
Starting Member

26 Posts

Posted - 2014-09-22 : 04:43:53
Create table #tmp( country varchar(12), code int)
insert into #tmp
Select 'ARGENTINA',10

Select concat(country,'+{',code,'}')--2012
from #tmp
Select country +'+{'+ cast (code as varchar(10))+'}'--2008
from #tmp

arunbabu
Go to Top of Page
   

- Advertisement -