How do I get list of all tables in a database using TSQL?

前端 未结 17 2016
无人及你
无人及你 2020-11-22 14:37

What is the best way to get the names of all of the tables in a specific database on SQL Server?

17条回答
  •  醉话见心
    2020-11-22 15:10

    Please use this. You will get table names along with schema names:

    SELECT SYSSCHEMA.NAME, SYSTABLE.NAME
    FROM SYS.tables SYSTABLE
    INNER JOIN SYS.SCHEMAS SYSSCHEMA
    ON SYSTABLE.SCHEMA_ID = SYSSCHEMA.SCHEMA_ID
    

提交回复
热议问题