Find all tables containing column with specified name

To find all tables in MS SQL Server that contain a column with a specified name, we can use the following query:

SELECT *
FROM INFORMATION_SCHEMA.COLUMNS
WHERE COLUMN_NAME LIKE '%your_column_name%'
ORDER BY TABLE_NAME;

Replace 'your_column_name' with the actual name of the column you want to search for. This query retrieves the TABLE_NAME from the INFORMATION_SCHEMA.COLUMNS view where the COLUMN_NAME matches the specified column name. It will return a list of tables that have a column with the specified name.

Popular Posts