In this post you will find some method of return some helpful information for Microsoft SQL
Get a list of databases
The below query will return a list of none system databases on a Microsoft SQL Server;
SELECT name FROM master..sysdatabases WHERE dbid > 4
Or you can run the below to get a list of databases along with their size and remarks;
Get the number of tables
The below SQL snippet will return a count of the number of tables in a database.
Make sure to change the “use” statement to the required database name
USE YOUR_DATABASE_NAME SELECT COUNT(*) from information_schema.tables WHERE table_type = 'base table'