To get a list of all tables in a database using T-SQL, use one of these simple queries:
Option 1: Easy and Standard Way
sql Copy code
SELECT TABLE_NAME
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_TYPE = ‘BASE TABLE’;
Option 2: Another Simple Way
sql Copy code
SELECT name AS TableName
FROM sys.tables;
Both will give you a list of all user-defined tables in the database.