Saturday, January 11, 2025
HomeComputer ScienceHow do I get List of all Tables in a Database Using...

How do I get List of all Tables in a Database Using TSQL?

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

See also  Micros and its Types in C

sql Copy code

SELECT name AS TableName

FROM sys.tables;

Both will give you a list of all user-defined tables in the database.

RELATED ARTICLES
0 0 votes
Article Rating

Leave a Reply

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
- Advertisment -

Most Popular

Recent Comments

0
Would love your thoughts, please comment.x
()
x