Cameron Snapp

Jun 09 2010

Text Search in SQL Server Stored Procedures: Overcoming sys.comments Insufficiencies

Searching a SQL Server database’s sys.comments table has long been a quick way to find stored procedure usage of another database, table, or column.  Likewise, clicking “view dependencies” on a table is a quick way to find the opposite: which stored procedures (on the local db) refer to that table.  I recently came across a scenario where neither met my needs, so I had to expand the capabilities of the former.  The limitation of the first approach is parsing the text field to find multiple items.  CHARINDEX and SUBSTRING functions only get you to the first, and looping can be incorrect as line breaks may occur haphazardly mid-text. 

Read More

 

Disclaimer

The words and opinions expressed here are those of each article's respective author, and do not necessarily represent the views of CapTech Ventures.