SQL Server search for a column by name

后端 未结 5 741
小蘑菇
小蘑菇 2020-12-31 02:12

I\'m doing some recon work and having to dig through a few hundred SQL Server database tables to find columns.

Is there a way to easily search for columns in the da

5条回答
  •  情话喂你
    2020-12-31 02:19

    SELECT OBJECT_NAME(object_id) FROM sys.columns WHERE name = 'foo'
    

    This includes views though but can be further filtered . It may be useful though.

    More generally...

    SELECT TABLE_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE COLUMN_NAME = 'foo'
    

    sys.columns

提交回复
热议问题