Baskar B.V

Microsoft Business Unit, Wipro Technologies

  Home  |   Contact  |   Syndication    |   Login
  21 Posts | 0 Stories | 14 Comments | 0 Trackbacks

News

Baskar

Archives

.NET Interop

BizTalk Links

Blogs

SQL-SERVER

Thursday, July 03, 2008 #

Column Pivot using COALESCE command:

I read this in an article today and thought worth sharing with you.

DECLARE @val VARCHAR(1000)

SELECT @val COALESCE(@val,'') + col1 ';' 
FROM table1

SELECT @val

The above command would concatinate the output of the column col1 in table1(say 100 rows) into a single column value. We can avoid using cursors.