Search for text in a SQL Server database

There are many cases when you need to search after some specific text into all the objects of a database:

  • replacing references of a commercial product name by another
  • moving an application from one environment to another,

Unfortunately not all software developers provide you assistance in this field.

There are many search T-SQL procedures available on the Internet, including this one by a former Microsoft guy. However it is not applicable if your database contains multiple schemas. Therefore here is a modified version that will handle those cases. Just create the procedure in the database you want to search for. Except when prefixed with DJ, comments are the original ones.


Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.