Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Database > SQL Language
SQL Language SQL Language discussions not specific to a particular RDBMS program or vendor.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Language section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old August 28th, 2006, 03:14 AM
Authorized User
Join Date: Jun 2003
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
Default denormalize into columns for report (beginner)


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

--**** 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_Multiple PK.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
                as decimal(18,0)
            AS VARCHAR(10)
    + '.. '
FROM #NormalizedData_MultiplePK
WHERE #NormalizedData_MultiplePK.ID_Student = @ID_Student

Daniel Hutchins
Woodbridge, CA
Daniel Hutchins
Stockton, CA

Similar Threads
Thread Thread Starter Forum Replies Last Post
Hiding Report Columns gupta_abhinav99 Crystal Reports 1 February 9th, 2007 04:38 AM
denormalize into columns for report (beginner) danielh SQL Server 2000 0 August 30th, 2006 01:03 AM
Multi-columns in a sub-report neilgould BOOK: Professional SQL Server Reporting Services ISBN: 0-7645-6878-7 0 November 11th, 2004 12:21 PM
Report Columns JohnBoyUK BOOK: Professional SQL Server Reporting Services ISBN: 0-7645-6878-7 1 October 28th, 2004 07:08 AM
columns dynamic in crystal report Fabian Bonjour Crystal Reports 2 October 7th, 2004 06:04 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.