February 8, 2011 at 8:16 pm
Comments posted to this topic are about the item Searching through SPs, Tables, Views
February 9, 2011 at 7:19 am
Be careful. The ROUTINE_DEFINITION returned by INFORMATION_SCHEMA.ROUTINES is nvarchar(4000). Using this view will miss references beyond that for procs/functions that are more than 4000 characters. The same goes for VIEW_DEFINITION. In SQL Server 2005 and above sys.sql_modules is a better alternative. The definition column returns the full code text - nvarchar(MAX). It includes procs, functions, views, triggers, and more.
Sample query:
[font="Courier New"]SELECT OBJECTPROPERTYEX(object_id, 'BaseType') AS ObjectType,
OBJECT_NAME(object_id) AS ObjectName,
definition
FROM sys.sql_modules
WHERE CHARINDEX('<text to find>', definition) > 0
ORDER BY ObjectType, ObjectName[/font]
May 17, 2016 at 6:49 am
Thanks for the script.
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy