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
 SQL Server Development (2000)
 (sp) select names by iteration

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-01-28 : 23:54:13
jon writes "I want to do an iterator inside a stored procedure. this query is trapped inside a WHILE loop which adds iCount ++ at bottom. on top of that, I want to refer the 'blahX' column name as simply 'blah'.

however this doesn't seem to work at all. Do I HAVE to do 8 different queries on top of oneother?

SELECT @sql = "SELECT 'blah' = blah"+@iCount +" FROM best WHERE order_id = @order_id AS best"
EXEC(@sql)

I'm stumped
best regards
Jon
jon@posterdreams.com
"
   

- Advertisement -