all groups > sql server (alternate) > march 2004 >
You're in the

sql server (alternate)

group:

sql server---Convert columns to rows


sql server---Convert columns to rows navinsm2 NO[at]SPAM rediffmail.com
3/31/2004 3:25:41 AM
sql server (alternate):
hi,
I need to convert columns to rows

here i have sample input data

weekno manager1 manager2
51 33454 26749
52 33454 26749

i wnat the output like this

weekno manager
51 33454
51 26749
52 33454
52 26749

Re: sql server---Convert columns to rows David Portas
3/31/2004 2:36:32 PM
SELECT weekno, manager1 AS manager
FROM SomeTable
UNION ALL
SELECT weekno, manager2
FROM SomeTable

--
David Portas
SQL Server MVP
--

AddThis Social Bookmark Button