Skip to content

Instantly share code, notes, and snippets.

@chrispret
chrispret / SP_SearchTables.sql
Last active September 27, 2023 19:29
Search SQL Tables for text with filters for tables, columns, and schema
-- Original found here: https://gallery.technet.microsoft.com/scriptcenter/c0c57332-8624-48c0-b4c3-5b31fe641c58
-- Modified to include column filter
IF OBJECT_ID('SP_SearchTables','P') IS NOT NULL
DROP PROCEDURE SP_SearchTables
GO
CREATE PROCEDURE SP_SearchTables
@Tablenames VARCHAR(500)
,@Columnnames VARCHAR(500)
,@IgnoreColumnForTextSearch Bit = 0
,@SearchStr NVARCHAR(500) = '%9000%'