SQL Query that search given column name part and returns the related table , schema and column
DECLARE @SearchColumn AS VARCHAR(255) = '%City%'
SELECT t.name AS TableName
,SCHEMA_NAME(SCHEMA_ID) AS SchemaName
,c.name AS ColumnName
FROM sys.tables AS t
INNER JOIN sys.columns AS c ON t.OBJECT_ID = c.OBJECT_ID
WHERE c.name LIKE @SearchColumn
No comments:
Post a Comment