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.
| Author |
Topic |
|
ssingh
Starting Member
25 Posts |
Posted - 2001-10-01 : 21:09:50
|
| I need urgent help if someone knows a better way to handle this. CREATE TABLE #TEMP (period int,day001 char(1),day002 char(1), day003 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 #TEMPDROP TABLE #TEMP--which gives/*period day001 day002 day003 ----------- ------ ------ ------ 1 A P P2 P P P3 A A U(3 row(s) affected)-- now I need to create cols to rows. This is an Attendance table for a kid for the whole year. So there are over 200 days like-- day1, day2, ...day200 AND 1 to 9 periods. I need to create a report in which I need to display data asdays period_1 period_2 period_3--------- -------- -------- --------001 A P A002 P P A003 P P UOne way I thought of is using cursor. But it is too long code. Is there another easier way to convert columns to rows.*/ |
|
|
|
|
|
|
|