How to find column names for all tables in all databases in SQL Server

前端 未结 13 634
被撕碎了的回忆
被撕碎了的回忆 2020-11-28 04:30

I want to find all column names in all tables in all databases. Is there a query that can do that for me? The database is Microsoft SQL Server 2000.

13条回答
  •  北荒
    北荒 (楼主)
    2020-11-28 04:32

    SELECT * 
    FROM information_schema.columns 
    WHERE column_name = 'My_Column'
    

    You must set your current database name with USE [db_name] before this query.

提交回复
热议问题