Interview Question in SQL Server Indexing


 

Interview Question :: How to query a table whose name is derived from another table


I have a SQL database which has a number of tables, I have a table which has the names of all the tables in the database. I first need to derive name of a table from this table and then query that table. So the query is like:
SELECT * FROM (SELECT TABLE FROM INDEX_TABLE).
Please solve this problem for me as it is really urgent!! Thank you!! I got a project stuck because of this!! And I shall surely put your name on my project and shall personally tell you when it is online!!
Answers to "How to query a table whose name is derived from another table"
RE: How to query a table whose name is derived from another table?

This query can be written in two froms

1. select * from firsttable_name where name in(select name from the secondtable_name where cond2);

2. select * from firsttable_name f,secondtable s where f.name = s.name and other_condition



If you have any doubts over this contact me at

unfussydanny@yahoo.co.in
 
Vote for this answer ::  
Update Alert Setting