Introduction
In this article, we will discuss how to get the list of table names that contain specific columns. Sometimes we may need to find the table names which contain similar column names or we may know the column name but, we may not remember the table name. By using a simple query we can find the table name.
Using INFORMATION_SCHEMA.COLUMNS Table
Syntax
SELECT COLUMN_NAME AS [Column Name]
,TABLE_NAME AS [Table Name]
FROM INFORMATION_SCHEMA.COLUMNS
WHERE COLUMN_NAME LIKE '%Column Name%'
ORDER BY [Table Name]
Sample Query
SELECT COLUMN_NAME AS [Column Name]
,TABLE_NAME AS [Table Name]
FROM INFORMATION_SCHEMA.COLUMNS
WHERE COLUMN_NAME LIKE '%Name%'
ORDER BY [Table Name]

Conclusion
In this simple article, we discussed how to get the list of table names based on the column name. Hope this simple tip was useful. Please share your feedback in the comment section. We will discuss more in upcoming articles.
Leave a Reply