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)
 dynamic select statement in a stored procedure

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-01-28 : 23:34:51
Richard writes "I have read your articles on dynamic stored procedures. They are very useful and cover the topic of how to make the where or the sort segment of the select statement dynamic. However, I need to make the column names that I am selecting dynamic.

For example - I need to have the select statement change each time I run it -

select HOMERUNS from rosters where team = 'yankees'

next time:
select RUNSBATTEDIN from rosters where team = 'yankees'

next time:
select WINS from rosters where team = 'yankees'

etc.

I can't see how to pass in that column variable.

THANKS!!!!!!"
   

- Advertisement -