May 11, 2016 at 10:53 am
The following gets the def of all the stored procs.
Similarly can i get the SQL for finding the def of all views ?
SELECT p.name, m.definition
--, charindex('FRGClaims', m.definition, 1 )
FROM sys.procedures p
JOIN sys.sql_modules m ON p.object_id = m.object_id
--where
--charindex('FRGClaims', m.definition, 1 ) > 0
--ORDER BY 3 desc
May 11, 2016 at 10:58 am
sys.sql_modules will also have view definitions.
You'd just need to join to sys.views instead.
I'd actually prefer just joining to sys.objects. You can then just filter to whatever object type or types you are looking for.
Cheers!
May 11, 2016 at 11:05 am
Thx,
i found it on google
SELECT TABLE_NAME as ViewName,
charindex('fnGetProviderHoursByProviderNo', VIEW_DEFINITION, 1 ),
VIEW_DEFINITION as ViewDefinition
FROM INFORMATION_SCHEMA.Views
where
charindex('fnGetProviderHoursByProviderNo', VIEW_DEFINITION, 1 ) > 0
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply