Wednesday 20 November 2013

Count number of tables in a SQL Server database

Leave a Comment
I got a request from a user and he wanted to count the number of tables in a database. It's quiet simple. Just use the information_schema.tables

USE <db name>
SELECT COUNT(*) from information_schema.tables
WHERE table_type = 'base table'

Will return you the count of the tables in the database

The Tables













The sql statement 

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



The Output







By
NOTE : – If You have Found this post Helpful, I will appreciate if you can Share it on Facebook, Twitter and Other Social Media Sites. Thanks =)

0 comments:

Post a Comment

Subscribe to our newsletter to get the latest updates to your inbox.

Your email address is safe with us!




Founder of developersnote.com, love programming and help others people. Work as Software Developer. Graduated from UiTM and continue study in Software Engineering at UTMSpace. Follow him on Twitter , or Facebook or .



Powered by Blogger.