List names of all tables in a SQL Server 2012 schema

前端 未结 6 430
再見小時候
再見小時候 2021-02-02 06:05

I have a schema in SQL Server 2012.

Is there a command that I can run in SQL to get the names of all the tables in that schema that were populated by user?

I kno

6条回答
  •  挽巷
    挽巷 (楼主)
    2021-02-02 06:19

    Your should really use the INFORMATION_SCHEMA views in your database:

    USE 
    GO
    SELECT * FROM INFORMATION_SCHEMA.TABLES
    

    You can then filter that by table schema and/or table type, e.g.

    SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE='BASE TABLE'
    

提交回复
热议问题