Click to Rate and Give Feedback
MSDN
MSDN Library
SQL Server
SQL Server 2008
Database Engine
Technical Reference
 sp_databases (Transact-SQL)
Community Content
In this section
Statistics Annotations (0)
Other versions are also available for the following:
SQL Server 2008 Books Online (December 2008)
sp_databases (Transact-SQL)

Lists databases that either reside in an instance of the SQL Server 2005 Database Engine or are accessible through a database gateway.

Topic link icon Transact-SQL Syntax Conventions

sp_databases

None

Column name Data type Description

DATABASE_NAME

sysname

Name of the database. In the Database Engine, this column represents the database name as stored in the sys.databases catalog view.

DATABASE_SIZE

int

Size of database, in kilobytes.

REMARKS

varchar(254)

For the Database Engine, this field always returns NULL.

Database names that are returned can be used as parameters in the USE statement to change the current database context.

sp_databases has no equivalent in Open Database Connectivity (ODBC).

Requires CREATE DATABASE, or ALTER ANY DATABASE, or VIEW ANY DEFINITION permission, and must have access permission to the database. Cannot be denied VIEW ANY DEFINITION permission.

The following example shows executing sp_databases.

USE master;
GO
EXEC sp_databases;

Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker