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,'''','')

Thursday, June 24, 2010

Permissions required to access SQL Server from MS Query

MS Query relies on system stored procedures to perform actions like fetching table lists from SQL Server.

Stored procedures that have been identified as required:

mssqlsystemresource.sys.sp_tables
mssqlsystemresource.sys.sp_datatype_info
mssqlsystemresource.sys.sp_columns

(to be completed)