I have a job table with a "jobID" as primary key. I have multiple related tables that have a "jobID" foreign key column. I need to correct bad "jobID" data across all the tables. The name "jobID" is used in all the tables.
This query (found online) gives me all the tables that contain the "jobID" column.
SELECT t.name AS table_name,
SCHEMA_NAME(schema_id) AS schema_name,
c.name AS column_name
FROM sys.tables AS t
INNER JOIN sys.columns c ON t.OBJECT_ID = c.OBJECT_ID
WHERE c.name LIKE '%jobID%'
ORDER BY schema_name, table_name;