
June 7th, 2004, 07:09 PM
|
|
Registered User
|
|
Join Date: Jun 2004
Posts: 1
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
Assign unique column names in a loop?
I have a loop that continues to add new columns at the end of a table, until their is no more data, from the source table, to add. However, I'm running into a problem, I can't figure out how to code assigning unique column names within a looping program.
Is there a way to name a column uniquely for each pass through the loop?
I tried the following:
(Setting a declare to equal the date for which the column represents)
declare @date
set @date = (select min(rate_date) from tbl_mastertable)
(But it won't allow me to use the declare as part of the column name.)
select a.*, b.price as 'Column_' + @date
Can anyone help?
Thanks in advance!
|