Now, I want to share how to find tables that contain a field name. Querying it by the keyword of specific field name.
USE DATABASENAME
SELECT c.name AS fieldname, t.name AS tablename
FROM sys.columns c
JOIN sys.tables t ON c.object_id = t.object_id
WHERE c.name LIKE '%FIELDNAME%'
OR
USE DATABASENAME
SELECT COLUMN_NAME, TABLE_NAME
FROM INFORMATION_SCHEMA.COLUMNS
WHERE COLUMN_NAME LIKE '%FIELDNAME%'
Click here if you like this article.
0 Comments