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
 Append the column data

Author  Topic 

plsqldev
Starting Member

11 Posts

Posted - 2011-07-20 : 15:53:57
My query in the stored procedure retuns some thisng like this.
Num Code_1 Code_2
1 1230 A12
1 1230 C13
1 1230 B14
2 1230 R115
3 1234 A12
3 1234 A13
4 1124 NULL

I need to conacatenete code_2 data by Num as below.

Num Code_1 Code_2
1 1230 A12,A13,B14
2 1230 R115
3 1234 A12,C13
4 1124 NULL


Can any one help me. It is urgent. Thank you in advance.

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2011-07-20 : 16:07:21
Are you using SQL Server or Oracle? I ask because of your userid, and it'll make a difference for your question. SQLTeam.com specializes in Microsoft SQL Server.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

plsqldev
Starting Member

11 Posts

Posted - 2011-07-20 : 22:29:02
I am using SQL Server 2005.

My query in the stored procedure retuns some thing like this.
Num Code_1 Code_2
1 1230 A12
1 1230 C13
1 1230 B14
2 1230 R115
3 1234 A12
3 1234 A13
4 1124 NULL

I need to conacatenete code_2 data by Num as below.

Num Code_1 Code_2
1 1230 A12,C13,B14
2 1230 R115
3 1234 A12,A13
4 1124 NULL


Can any one help me. It is urgent. Thank you in advance.
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2011-07-20 : 22:37:18
maybe you should change your id to tsqldev

refer to this link below on how to get the output that you want

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=81254


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page
   

- Advertisement -