I'm looking to search for a specific column name across an entire SQL DB, and it's unclear how to go about doing that.
Would anyone have advice on the correct syntax?
I'm looking to search for a specific column name across an entire SQL DB, and it's unclear how to go about doing that.
Would anyone have advice on the correct syntax?
You can query the sys.columns
system table and join various other system tables. Something along the lines of:
SELECT o.type,
s.name schema_name,
o.name object_name,
c.name column_name
FROM sys.columns c
INNER JOIN sys.objects o
ON o.object_id = c.object_id
INNER JOIN sys.schemas s
ON s.schema_id = o.schema_id
WHERE c.name = <column name you search for>;