Hello All,
I was trying to get all SP's referring ABS_tbl using below query. but in output it retieve all the SP's referring ABS_tbl including those having incorrect suffix.
SELECT DISTINCT so.name
FROM syscomments sc
INNER JOIN sysobjects so ON sc.id=so.id
WHERE so.type in ('P') and TEXT like '%ABC_tbl%'
--Output- 250+ SPs
Also tried below query by removing % as suffix but it returns only 1 SP and filtering even those that referred table name as ABC_tbl. Am I doing anything wrong here?
SELECT DISTINCT so.name
FROM syscomments sc
INNER JOIN sysobjects so ON sc.id=so.id
WHERE so.type in ('P') and TEXT like '%ABC_tbl'
--output 1 SP
Amit MohantyPosted Apr 3, 2023, 4:07 AM
Anupam MaitiPosted Apr 2, 2023, 5:47 AM
Can you try this and let me know if it works for you.
Sachin SinghPosted Apr 1, 2023, 6:24 PM
Test this
Naimish MakwanaPosted Apr 1, 2023, 2:48 PM
Try below conditoin.
Thanks
Rajkiran SwainPosted Mar 31, 2023, 3:09 PM