Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
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.
SELECT [filename] FROM ClientFile CFINNER JOIN VersionFile VFON CF.clientfileid = VF.clientfileidINNER JOIN Version VON VF.Versionid = V.VersionidAND V.workorderid = 9 By Running this query I am getting the output like FileNamesample1_3_147_1.txtsample2_4_258_2.txtI want Output in FileNamesample1_3_147_1.txt,sample2_4_258_2.txtthis formatPlease help me how to approach ?Thanks
bklr
Master Smack Fu Yak Hacker
1693 Posts
Posted - 2009-02-26 : 02:27:59
try like this
SELECT STUFF((SELECT ','+ [filename] FROM ClientFile CFINNER JOIN VersionFile VF ON CF.clientfileid = VF.clientfileidINNER JOIN Version V ON VF.Versionid = V.Versionid AND V.workorderid = 9 FOR XML PATH('')),1,1,'')