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 tablename in SELECT Statement

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-06-14 : 10:29:18
FrankUray writes "Hello

I do not know if that is possible, and if yes how.

The idea would be something like that:
SELECT * FROM (SELECT tablename FROM xy WHERE criteria = 'xy')

Of corse this example does not work, but is there a way to do something like that in a view (not in a stored procedure)?

Thanks
Frank"

RickD
Slow But Sure Yak Herding Master

3608 Posts

Posted - 2002-06-14 : 10:35:26
If you are using SQL 2000 then yes..

Peace

Rick

Go to Top of Page

Merkin
Funky Drop Bear Fearing SQL Dude!

4970 Posts

Posted - 2002-06-14 : 10:37:47
Woah there.

No!

Although it looks like you are trying to use a derived table I think you actually want to dynamically pick a table name.

To do this you need dynamic sql

Damian
Go to Top of Page
   

- Advertisement -