Lists databases present in the SQL Server installation or accessible through a database gateway.
sp_databases
In SQL Server, sp_databases returns the databases listed in the sysdatabases system table. Because some DBMS systems 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.
The sp_databases catalog stored procedure has no equivalent in ODBC.
This is the results set:
Column | Datatype | Description |
---|---|---|
DATABASE_NAME | char(32) | Is the name of the database. In Microsoft SQL Server, this column represents the database name as stored in the sysdatabases system table. |
DATABASE_SIZE | int | Is the size of database, in kilobytes. |
REMARKS | int | For Microsoft SQL Server, this field will always return NULL. |