How to Get the Number of Tables from SQL Server Database ?

Below is a sample SQL query that demonstrates how to count the number of tables in a SQL Server database using information_schema.tables.

How to Get the Number of Tables from SQL Server Database ?

USE TrainingDB1
SELECT COUNT(*) as TableNos from information_schema.tables 
WHERE table_type = 'base table' 

If you enjoyed this post, please consider leaving a comment or subscribing to the RSS feed to have future articles delivered to your feed reader.

Leave a Reply


x

Interesting BlogPosts to read

Dealing with the column names that looks like SQL Keywords in SQL Server
There are times when you might have a column names in your SQL Server database table that might look...
SQL Server's ISNULL() equivalent in PostgreSQL
SQL Server provides an function ISNULL if the value placed in the 2nd parameter if the first paramet...
Kill all the current active connection in SQL Server database
There are times when you want to kill all the current active connections of your SQL Server database...