devxlogo

Listing Available Tables

Listing Available Tables

Question:
How do I list the available tables in a database I’m querying?

Answer:
You can get a list of tables in a database by calling the INFORMATION_SCHEMA.Tables view like this:

SELECT * FROM information_schema.tables

This returns the name of the current database, the owner, the table name, and the table type for each table in the database. It’s possible to query the system tables directly, but if this gives the information you need, it’s better to use the existing views that come with SQL Server.

devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist