S  SaravanaKumar S SaravanaKumar
Updated date Jan 07, 2021
In this blog, we will see how to get all the table names in the SQL Server database. . We can easily find out all the tables in the SQL server database using the below two methods.

Introduction :

In this article, we will see how to get all the table names in the SQL Server database. We can easily find out all the tables in the SQL server database using below two methods.

SQL Query :

Method 1:

First, select the database using USE (as shown below) where you want to find out the table names.

USE Sample; // Sample is database name

SELECT TABLE_NAME FROM information_schema.tables WHERE table_type = 'base table'

In the above SQL Query, we select Table_Name Field from the system table called Information_Scheme.table and filter by table_typle as 'base table' to get the table details from selected database "Sample".

Result:

Method 2:

You can also use sys.tables  to get all table names from the selected database as shown in the following SQL query :

USE Sample;

SELECT name FROM sys.tables;

Result:

Summary :

In this article, we have learned using how to get all the table's names in the SQL Server database using a query.

ABOUT THE AUTHOR

S  SaravanaKumar
S SaravanaKumar
Software Professional, India

Software professional with 10+ years of experience in Microsoft Technologies with strong base in Microsoft .NET (C#.Net, ASP.Net MVC, ASP.NET WEB API, Webservi...Read More

https://www.techieclues.com/profile/saravana-kumar

Comments (0)

There are no comments. Be the first to comment!!!