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)
 Query in which columnnames and tablenames are determined through a query.

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-03-22 : 10:19:28
shubhro writes "I have a query which I know doesn't work.The query is given here:
SELECT (SELECT syscolumns.name
FROM syscolumns
WHERE syscolumns.id = 133575514 AND
syscolumns.colid = 1) columnname
FROM (SELECT sysobjects.name
FROM sysobjects
WHERE sysobjects.id = 133575514) tablename

The values can be replaced with valid ones for your database. The subqueries work separately. what I am trying to achieve from this query is given below. The first subquery should return a columnname and the second subquery should retrun a tablename.So finally I should have all the values in that column for that table. One workaround is to use three different queries. My question is is it possible to achieve the same in one query ?"
   

- Advertisement -