Try to search your question here, if you can't find : Ask Any Question Now ?

Is there any other option rather than Stuff

HomeCategory: stackoverflowIs there any other option rather than Stuff
Avatarkundan asked 5 months ago

my code:

declare @Test Table(sno int,scity varchar(20))
Insert @Test(sno,scity)
Values
(1,'Chicago'),(1,'Detriot')
,(2,'Memphis'),(2,'Nashville')
,(3,'New York'),(3,'Dallas')
,(4,'Atlanta'),(4,'Houston')

select  sno ,
a=STUFF((Select ','+Scity
from @Test T1
where T1.sno=T2.sno
FOR XML PATH('')),1,1,'') from @Test T2
group by sno

is There any other option rather than Stuff method?

1 Answers
Best Answer
Avatarnaveen answered 5 months ago
Your Answer

12 + 3 =

Popular Tags

WP Facebook Auto Publish Powered By : XYZScripts.com