|
Subject:
|
denormalize into columns for report (beginner)
|
|
Posted By:
|
danielh
|
Post Date:
|
8/28/2006 3:14:51 AM
|
Please,
In SQL SERVER 2000, I am doing a recursive select, which generates a long string that is not tab-delimited. On every recursion, I tried adding '\t', the escape character for tab, but excel ignores '\t', and prints the long string (with multiple '\t') into a single column. Not very convenient.
From maximum 70 rows, I want to convert into maximum 70 columns, with headings at the top of every one.
I am sure that this must look like a silly beginner question, but if anyone would like to take the time to show me how to report like this, I would sure appreciate. It would be helping a school teacher who writes his own student performance database.
If I can't get a simple answer, then I think I'll have to write some script.
Thank you, Daniel Hutchins Teacher, Stockton, CA
select --**** Scores: @decSumScores = @decSumScores + isNull(#NormalizedData_MultiplePK.decScores,0.), --**** Points Possible: @decSumPtPossible = @decSumPtPossible + isNull(#NormalizedData_MultiplePK.decPtPossible,0.), --**** Code: @strConcatCodes = @strConcatCodes + isNull(convert(varchar(6),#NormalizedData_MultiplePK.smDates,7),'?') + ':' + cast( isNull( #NormalizedData_MultiplePK.codes, '' ) as varchar(20) ) + ',' + cast(isNull(#NormalizedData_MultiplePK.decScores,0.) AS VARCHAR(10)) + '/' + cast( --as string cast( --as decimal isNull(#NormalizedData_MultiplePK.decPtPossible,0) as decimal(18,0) ) AS VARCHAR(10) ) + '.. ' FROM #NormalizedData_MultiplePK WHERE #NormalizedData_MultiplePK.ID_Student = @ID_Student
Daniel Hutchins Woodbridge, CA http://www.finehomemadesoap.com
|
|