Need to find a Column

  • Hello Everyone

    Happy Friday

    I am working with a large database, where all the tables were not named with descriptive names. How can I locate every table that contains a certain column?

    Thanks

    Andrew

  • You can query view INFORMATION_SCHEMA.COLUMNS

    select table_name ,column_name from information_schema.columns

    where column_name = 'column_name'

  • Another option.

    SELECT t1.name, t2.name

    FROM sys.tables t1

    JOIN sys.columns t2 ON t2.object_id = t1.object_id

  • Thanks

    That was perfect, just what I needed

    Have a good one

    Andrew

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply