Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Database > SQL Language
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old August 28th, 2006, 03:14 AM
Authorized User
 
Join Date: Jun 2003
Location: Stockton, CA, USA.
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
Default denormalize into columns for report (beginner)

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_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
                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
__________________
Daniel Hutchins
Stockton, CA
http://www.finehomemadesoap.com
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 01:30 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.