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)
 tables list used in a procedure!!

Author  Topic 

js.reddy
Yak Posting Veteran

80 Posts

Posted - 2009-07-06 : 08:24:17
Hi Folks,

Is there any way to get the list of tables used in partcular stored procedure.

Regards
js.reddy

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-07-06 : 08:28:07
exec sp_depends 'procedure name'

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

js.reddy
Yak Posting Veteran

80 Posts

Posted - 2009-07-06 : 08:31:38
Thanks Madhivanan.
But I want unique table names list.

quote:
Originally posted by madhivanan

exec sp_depends 'procedure name'

Madhivanan

Failing to plan is Planning to fail

Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-07-06 : 08:38:17
select distinct object_name(depid) as table_name from sys.sysdepends
where id=object_id('procedure name')

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

js.reddy
Yak Posting Veteran

80 Posts

Posted - 2009-07-06 : 08:45:40
Thank you so much Madhivanan.

quote:
Originally posted by madhivanan

select distinct object_name(depid) as table_name from sys.sysdepends
where id=object_id('procedure name')

Madhivanan

Failing to plan is Planning to fail

Go to Top of Page
   

- Advertisement -