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 2005 Forums
 Transact-SQL (2005)
 use cloumn value as tablename

Author  Topic 

akpaga
Constraint Violating Yak Guru

331 Posts

Posted - 2008-11-30 : 19:48:51
hi

i have a temp table that has two coloumns . One coloumn contains the

the tablename of a database.

I want to query the temptable and use the coloumnvalue as a tablename

in another select statement.

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-11-30 : 23:44:28
Execute this query and use the result as query in another window
SELECT 'SELECT *
FROM ' + COLUMNNAME
FROM YourTable
Go to Top of Page
   

- Advertisement -