SQL NET - A Place to talk on MS SQL Server and other database tools

Talks on SQL Server, database development, data management techniques,SQLBI/SSIS/SSAS/SSRS etc. Want to publish something db related ? mail to bineeshthomas@gmail.com with subject line starting as "SQLNET"

SQL NET FORUM

Portal Maintained By : BINEESH THOMAS

Monday, December 28, 2009

Rows to Column transpose

SELECT [id]

      ,[nam]

      ,[city]

  FROM [aaaa]

GO

DECLARE @str VARCHAR(100)

SELECT @str = COALESCE(@str + ' ,', '') + [city]+[nam]  FROM [aaaa]

SELECT category= @str

 
 

-- contributed by Sheju Gangadharan

0 Comments:

Post a Comment

Links to this post:

Create a Link

<< Home

Free Domain Name - www.YOU.co.nr!