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 |
vision.v1
Yak Posting Veteran
72 Posts |
Posted - 2012-04-20 : 09:44:57
|
Hi,How can i get the list of stored procedures that uses the table 'EmployeeTable' excluding the stored procedures which contains the'EmployeeTable' in comment section.To find the list of stored procedures that contains the 'EmployeeTable'I tried following, but my issue is it list the stored procedure name if 'EmployeeTable' contains in comment section also plz advice.SELECT NameFROM sys.objects WHERE OBJECT_DEFINITION(OBJECT_ID) LIKE '%Employee%'SELECT NameFROM sys.proceduresWHERE OBJECT_DEFINITION(OBJECT_ID) LIKE '%Employee%'SELECT DISTINCT o.name AS Object_Name, o.type_desc , m.definitionFROM sys.sql_modules mINNER JOIN sys.objects oON m.object_id = o.object_idWHERE m.definition Like '%Employee%'ORDER BY 2,1 |
|
yosiasz
Master Smack Fu Yak Hacker
1635 Posts |
Posted - 2012-04-20 : 10:03:18
|
might this helpSelect DistinctSysObjects.Name 'Table Name', Procedures.Name 'Stored Procedure'From SysObjects Join (SysObjects Procedures Join SysDepends on Procedures.Id = SysDepends.Id) On SysDepends.DepId = SysObjects.IdWhere SysObjects.XType = 'U'-- Change XType Values here using chart aboveAnd Procedures.XType = 'P'Group by SysObjects.Name, SysObjects.Id, Procedures.NameOrder by SysObjects.Name Asc from http://www.myitforum.com/articles/1/view.asp?id=11086<><><><><><><><><><><><><><><><><>If you don't have the passion to help people, you have no passion |
 |
|
|
|
|