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.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Create Column Names with Variables

Author  Topic 

AndyD
Starting Member

1 Post

Posted - 2007-03-19 : 00:40:49

Is there a way I can either create a table and name the columns using variables or select data from a table renaming the column with a variable, eg. Select W1Quantity as @Column1Heading From #Results (it's not happy with this)?

There will be 8 columns where the column names need to include a week number but the week numbers will differ each time the report is run depending on the date range selected. I thought I could create a variable for each of the columns so I've got the right week number and then use the variables either when I create the temp table or do the select statement from the temp table.

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-03-19 : 01:45:26
please post at appropriate forum.


KH

Go to Top of Page

graz
Chief SQLTeam Crack Dealer

4149 Posts

Posted - 2007-03-19 : 09:20:43
(Post moved to a different forum)

===============================================
Creating tomorrow's legacy systems today.
One crisis at a time.
Go to Top of Page
   

- Advertisement -