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 2000 Forums
 SQL Server Development (2000)
 converting columns to rows

Author  Topic 

ssingh
Starting Member

25 Posts

Posted - 2001-10-01 : 13:44:11
-- I have a table in which I need to convert columns to rows to display in a report. For example
CREATE TABLE #TEMP (period int,day1 char(1),day2 char(1), day3 char(1))
INSERT #TEMP VALUES (1,'A','P','P')
INSERT #TEMP VALUES (2,'P','P','P')
INSERT #TEMP VALUES (3,'A','A','U')

SELECT * FROM #TEMP
drop table #temp
-- Now I want to show my data as
SchoolDay period_1 period_2 period_3
--------------------------------------
day1 A P A
day2 p p P
day3 A A U

--PLEASE SUGGEST HOW CAN I DO THAT

   

- Advertisement -