List All Databases in SQL Server

SQL Server

One of the important tasks of a Database Administrator is to keep track of what databases exist on which SQL Server instances. Using the query below, you can get the information about what databases exist on your server:

EXEC sp_helpdb

This returns:

Column name Data type Description
name sysname Database name.
db_size nvarchar(13) Total size of the database.
owner sysname Database owner, such as sa.
dbid smallint Database ID.
created nvarchar(11) Date the database was created.
status nvarchar(600) Comma-separated list of values of database options that are currently set on the database.
compatibility_level tinyint Database compatibility level: 60, 65, 70, 80, or 90.
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s