Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Printing values as column headings

Status
Not open for further replies.

renee35

MIS
Jan 30, 2007
199
Does anyone know how to print a value as a column heading in the report? Here is the data I am pulling:

[Week1] = sum( case when DATEPART(ww, weekending) = 1 then isnull( e.AllTCHours, 0) else 0 end ),
[Week2] = sum( case when DATEPART(ww, weekending) = 2 then isnull( e.AllTCHours, 0) else 0 end ),
[Week3] = sum( case when DATEPART(ww, weekending) = 3 then isnull( e.AllTCHours, 0) else 0 end ),
[Week4] = sum( case when DATEPART(ww, weekending) = 4 then isnull( e.AllTCHours, 0) else 0 end )

What I would like to accomplish is, instead of the column heading reading:

Week1 Week2 Week3, etc. I would like for it to read:

2009-1-5 2009-1-12 2009-1-19, etc?

Any help would be greatly appreciated!

Thanks a bunch!!

-T
 
SQL is not meant for this kind of data presentation, a front end app should be used.
If you must use SQL, then you will have create a temp table or table variable, with the column names you want, and then select your results into the that table.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top