Tuesday, November 26, 2024

Find all Tables that Contain a Specific Column Name in SQL Server

SELECT
    TABLE_CATALOG,
    TABLE_SCHEMA,
    TABLE_NAME,
    COLUMN_NAME,
    ORDINAL_POSITION as org_pos,
    DATA_TYPE,
    CHARACTER_MAXIMUM_LENGTH as CML
FROM
    INFORMATION_SCHEMA.COLUMNS
WHERE
    COLUMN_NAME LIKE '%Err%'
ORDER BY

    TABLE_NAME; 

No comments:

Post a Comment