Friday, June 25, 2010

SQL Server search all table columns code

Codekeep.net has a great stored-proc-free code snippet for text searching SQL Server database columns.

Unfortunately this code fails due to single quotes in the column names of the database I'm working with (I know I know, don't get me started!)

It's a simple fix.

On line 43, replace

@ColumnName

with

replace(@ColumnName,'''','')

No comments: