Lists databases that reside in the Microsoft® SQL Server™ installation or are accessible through a database gateway.
sp_databases
None
| 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. | 
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).
Execute permissions default to the public role.