GOselect * from sys.objects where type_desc='USER_TABLE' order by nameGO
或
-- For all tablesselect * from INFORMATION_SCHEMA.TABLESGO
--- For user defined tablesselect * from INFORMATION_SCHEMA.TABLES where TABLE_TYPE='BASE TABLE'GO
--- For Viewsselect * from INFORMATION_SCHEMA.TABLES where TABLE_TYPE='VIEW'GO
Any of the T-SQL code below will work in SQL Server 2019:
-- here, you need to prefix the database name in INFORMATION_SCHEMA.TABLESSELECT TABLE_NAME FROM [MSSQL-TEST].INFORMATION_SCHEMA.TABLES;
-- The next 2 ways will require you to point-- to the specific database you want to list the tables
USE [MSSQL-TEST];-- (1) Using sys.tablesSELECT * FROM sys.tables;
-- (2) Using sysobjectsSELECT * FROM sysobjectsWHERE type='U';
Here’s a working example using [Skyvia] using sys.tables.
[Skyvia] should be the link to https://skyvia.com/connectors/sql-server
[1]: https://i.stack.imgur.com/o3qo9.png
Your SQL GUI tool should also have a way to list down all the tables in a database like the one above.
So, whatever suits your need and taste, there’s a code or GUI tool for that.