Bharat Patel     Feb,08 2017

SQL Server Get Table List from Column Name

Today, I wanted to list down all table from column name in sql server. Sql server stores all table, column, database or etc in it's own system table. So it's easy to fetch record from it. I have given example below how to list down table list from field name. Copy and paste below code and just pass column name in this query. I hope it is helpful for you and you may like it.

select sys.tables.namefrom sys.objects inner join sys.tableson sys.objects.object_id = sys.tables.object_idand sys.tables.type = 'U'inner join sys.columns on sys.tables.object_id = sys.columns.object_idwhere sys.columns.name = 'XYZ'order by sys.tables.name