Author |
Topic |
praveen050
Starting Member
9 Posts |
Posted - 2012-05-23 : 03:00:40
|
Write a SQL to convert Multiple Records in to Comma Separated values and Insert into Different tableWrite a sql to load data as comma separated one record per Agent in to T_AGENT_CSVEXT.EX: if TAGENT hasAgent_ID Agent_Extensionaapena 83601014aapena 83601014aapena 83605027aapena 83605236aapena 83605473aapena 83605724T_AGENT_CSVEXT should have Agent_ID Agent_Extensionaapena 83601014,83605027,83605236,83605473,83605724 |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2012-05-23 : 03:12:11
|
Thank you for posting your assignment question. Can you also shared with us the solution ? KH[spoiler]Time is always against us[/spoiler] |
 |
|
praveen050
Starting Member
9 Posts |
Posted - 2012-05-23 : 03:14:14
|
i m not getting the solution |
 |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2012-05-23 : 03:57:03
|
what have you tried ? KH[spoiler]Time is always against us[/spoiler] |
 |
|
praveen050
Starting Member
9 Posts |
Posted - 2012-05-23 : 09:04:02
|
open tabcurdeclare @g varchar(1000)fetch tabcur into @gwhile (@@FETCH_STATUS=0)beginif (@g=@g)DECLARE @ext varchar(100) SELECT @ext = COALESCE(@ext + ', ', '') + cast(id as varchar) FROM tab where mm=@gprint @g +' ' +@extfetch tabcur into @gendand my resulthh 1, 2, 3, 4hh 1, 2, 3, 4, 1, 2, 3, 4hh 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4hh 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4gg 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 5, 6, 7gg 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 5, 6, 7, 5, 6, 7gg 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 5, 6, 7, 5, 6, 7, 5, 6, 7but i want hh 1,2,3,4gg 5,6,7 |
 |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
|
praveen050
Starting Member
9 Posts |
Posted - 2012-05-24 : 02:14:14
|
Thanks for your suggestion i got the answer, actually i have table with more than 8000 rows |
 |
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2012-05-24 : 02:47:02
|
quote: Originally posted by praveen050 Thanks for your suggestion i got the answer, actually i have table with more than 8000 rows
that will not be an issue.Just use the SELECT query in that thread KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
|
|