Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 

Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved scripts in your SSC briefcase from the favorites tab.
Download now (direct download link)

Find a string in compiled objects

By David Korb,

This utility will search for strings in procedures, functions, views, and even check constraints in just one database or across all online databases on the server. It uses SQL Server 2005 system views and takes advantage of varchar(max) allowing us to concatenate all of the text (definition)columns for each object into a single, comparable string. This overcomes the problem (in SQL Server 2000) of a given string being split across two adjacent text rows and not being able to join them easily. At the end of the procedure, these concatenated values are used in a "like" comparison with the input string to return all instances in your compiled code. Don't worry about underscore separated words in your search string: underscores are properly escaped and accounted for in the comparison. Execute without parameters for usage. If you feel like tricking it out, you can use the output_print and testing parameters to get feedback during development.

Enjoy!

Total article views: 338 | Views in the last 30 days: 1
 
Related Articles
BLOG

SQL Server Connection Strings

The purpose of this short post is to demonstrate a simple method of generating an accurate SQL Serve...

ARTICLE

Splitting Strings in SQL Server 2016

Comparison of the new methods of splitting strings in SQL Server 2016 to the tried and true methods

FORUM

string formatting

String Formatting

BLOG

Connection String from Visual Studio

Querying Microsoft SQL Server : Connection String from Visual Studio: Connection String: A connecti...

FORUM

string Comparison.

'string' = 'string___' ???

Tags
definition    
search    
string    
 
Contribute