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
 Transact-SQL (2000)
 obtain table names from select statement

Author  Topic 

Antonio Broughton
Starting Member

6 Posts

Posted - 2002-05-09 : 20:03:45
Hi,
I am wondering if it is possible to obtain the tablenames that are involved in a SELECT statement as a recordset?

I have looked at the 'SET STATISTICS IO', but this does not return a recordset...

Is this possible?

Thankyou
Antonio Broughton

jbkayne
Posting Yak Master

100 Posts

Posted - 2002-05-09 : 20:11:35
quote:

Is this possible?



I think using sp_depends '<sprocname>' should give you the tables involved in the procedure. However the underlying table sysdepends has been known to be inaccurate.



Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2002-05-09 : 20:19:42
I have to admit, I'm a bit perplexed as to why you'd want to do this in the first place. If you wrote the SELECT statement, wouldn't you already know which tables are involved?

Go to Top of Page
   

- Advertisement -