SQL Server 2014 Tutorial – List all the databases in SQL Server using Query

Problem Statement

You need to list all the databases that are present in the current SQL Server instance.

Solution

The list of all the databases from the SQL Server instance can be obtained from the sys.databases object as shown below.

1. Open SQL Management Studio and connect to the SQL Server instance with your login details.

2. Click the “New Query” button and enter the below query in the Query window and click on the “Execute” button. This will display the databases that exists on the server in the results tab.

clip_image002

Note that this displays all the databases that you created along with the “system databases”.

1 Comment

Leave Your Comment

Liked this content?. Please spread the word :)