Skip to content

Instantly share code, notes, and snippets.

@pwelter34
Created April 29, 2021 14:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pwelter34/196edc6b2e78dd8ff108ba609dfb26f0 to your computer and use it in GitHub Desktop.
Save pwelter34/196edc6b2e78dd8ff108ba609dfb26f0 to your computer and use it in GitHub Desktop.
SQL Server Schema Search
DECLARE @tableName NVARCHAR(256)
DECLARE @tableSchema NVARCHAR(100)
DECLARE @columnName NVARCHAR(256)
SET @tableName = '%CaseManager%'
SET @tableSchema = 'dbo'
SET @columnName = '%%'
SELECT *
FROM INFORMATION_SCHEMA.Columns
WHERE TABLE_NAME LIKE @tableName
AND COLUMN_NAME LIKE @columnName
AND TABLE_SCHEMA = @tableSchema
DECLARE @routineName NVARCHAR(256)
SET @routineName = '%%'
SELECT *
FROM INFORMATION_SCHEMA.ROUTINES
WHERE ROUTINE_NAME LIKE @routineName
DECLARE @tableName NVARCHAR(100)
DECLARE @tableSchema NVARCHAR(100)
SET @tableName = '%%'
SET @tableSchema = 'dbo'
SELECT *
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME LIKE @tableName
AND TABLE_SCHEMA = @tableSchema
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment