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
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Appending the result set to a single line

Author  Topic 

saurabh122
Starting Member

16 Posts

Posted - 2010-03-02 : 22:31:46
Hello,

I want to append a result set of a particular column to a string. How do I achieve the same?
Example:

Column
Result1
Result2
Result3

The string variable should return me: Result1Result2Result3

How do I do it using T Sql?

Thanks

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2010-03-02 : 22:47:14
Select 
STUFF((SELECT '' + COL FROM TABLE
FOR XML PATH('')), 1, 0,'')
Go to Top of Page
   

- Advertisement -