find sql table name with a particular column

In SQL Server, you can query sys.columns.

Something like:

 SELECT
     t.name
 FROM
     sys.columns c
        inner join
     sys.tables t
        on
           c.object_id = t.object_id
 WHERE
     c.name = 'NameID'

You might want an additional lookup to resolve the schema name, if you have tables in multiple schemas.


you can run this query

SELECT t.name AS table_name,
SCHEMA_NAME(schema_id) AS schema_name,
c.name AS column_name
FROM sys.tables AS t
INNER JOIN sys.columns c ON t.OBJECT_ID = c.OBJECT_ID
WHERE c.name LIKE '%Column%' -- write the column you search here
ORDER BY schema_name, table_name;

Tags:

Sql

Sql Server