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.
Author |
Topic |
mercyjhansi
Starting Member
3 Posts |
Posted - 2014-02-19 : 01:44:01
|
Is there a query to find in which all sps a particular table is inserted? |
|
bandi
Master Smack Fu Yak Hacker
2242 Posts |
Posted - 2014-02-19 : 07:01:24
|
;WITH stored_procedures AS (SELECT o.name AS proc_name, oo.name AS table_name,ROW_NUMBER() OVER(partition by o.name,oo.name ORDER BY o.name,oo.name) AS rowFROM sysdepends d INNER JOIN sysobjects o ON o.id=d.idINNER JOIN sysobjects oo ON oo.id=d.depidWHERE oo.name = 'ProcedureName' and o.xtype = 'P')SELECT proc_name, table_name FROM stored_proceduresWHERE row = 1ORDER BY proc_name,table_name--Chandu |
|
|
bandi
Master Smack Fu Yak Hacker
2242 Posts |
|
mercyjhansi
Starting Member
3 Posts |
Posted - 2014-02-21 : 05:22:58
|
bandi: Hey that query is returning all the sps in which the table is used. I need only the sps in which the table is inserted. |
|
|
|
|
|