Search inside objects (Sprocs, FUnctions, etc)

I am currently using sys.syscomments to locate objects where a certain parameter exists. Is there another method / process for doing this that would make it easier to find the objects that contain that parameter or term?

Thanks,

S

Answers


It would be preferable to use the definition column of sys.sql_modules instead. sys.syscomments text is nvarchar(4000) so you can have issues with truncation when a definition splits across multiple rows.

select quotename(s.name)+'.'+quotename(o.name) as object_name, o.type_desc
    from sys.sql_modules m
        inner join sys.objects o 
            on m.object_id = o.object_id
        inner join sys.schemas s 
            on o.schema_id = s.schema_id
    where m.definition like '%YourSearchText%'

Need Your Help

set SurfaceView's margin programatically

android layout surfaceview

I am adding the "SurfaceView" for camera in my layout xml file as,

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.