sp_databases (T-SQL)

Lists databases that reside in the Microsoft® SQL Server™ installation or are accessible through a database gateway.

Syntax

sp_databases

Return Code Values

None

Result Sets
Column name Data type Description
DATABASE_NAME sysname Name of the database. In SQL Server, this column represents the database name as stored in the sysdatabases system table.
DATABASE_SIZE int Size of database, in kilobytes.
REMARKS varchar(254) For SQL Server, this field always returns NULL.

Remarks

In SQL Server, sp_databases returns the databases listed in the sysdatabases system table. Because some database management systems (DBMS) accessed by database gateways do not have the concept of a database, this stored procedure may return no rows if sent to a Microsoft Open Data Services - based gateway.

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).

Permissions

Execute permissions default to the public role.

  


(c) 1988-98 Microsoft Corporation. All Rights Reserved.