In this post, we want to discuss all tables containing columns with the specified names in SQL Server. Before we get started, if you want to know the necessity of Store Procedure, please go through the following article: Why do we need use Stored Procedure?
Say the column name is “MyColumnName”. The SQL is as bellow
1 2 3 4 5 |
SELECT c.name AS ColName, t.name AS TableName FROM sys.columns c JOIN sys.tables t ON c.object_id = t.object_id WHERE c.name LIKE '%MyColumnName%' |
For searching in Tables and View in the same DB
1 2 3 4 |
SELECT COLUMN_NAME, TABLE_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE COLUMN_NAME LIKE '%MyColumnName%' |
Hiya very cool site!! Man .. Beautiful .. Amazing .. I’ll bookmark your website and take the feeds also? I am satisfied to seek out a lot of useful information right here in the put up, we need work out extra techniques on this regard, thank you for sharing. . . . . .|
Awesome post and really helpful for me