Tuesday, December 24, 2013

Find Stored Procedure name based on table name in sql server

Find Stored Procedure name based on table name in SQL SERVER


There are few query copy and paste in sql editor and change the name of table :


----Option 1 SELECT DISTINCT so.name
FROM syscomments sc
INNER JOIN sysobjects so ON sc.id=so.id
WHERE sc.TEXT LIKE '%tablename%'

----Option 2
SELECT DISTINCT o.name, o.xtype
FROM syscomments c
INNER JOIN sysobjects o ON c.id=o.id
WHERE c.TEXT LIKE '%tablename%'

No comments:

Post a Comment