Contains one row for each database on SQL Server. When SQL Server is initially installed, sysdatabases contains entries for the master database, the model database, and the tempdb database. The status column values are additive when more than one option is set or database condition applies.
Column | Datatype | Description |
---|---|---|
name | varchar(30) | Name of the database. |
dbid | smallint | Database ID. |
suid | smallint | Server user ID of database creator. |
mode | smallint | Used internally for locking a database while it is being created. |
status | smallint | Status bits, some of which can be set by the user with the sp_dboption system stored procedure (READ ONLY, DBO USE ONLY, SINGLE USER, and so on): 2 Database is in transition 4 select into/bulkcopy; set with sp_dboption 8 trunc. log on chkpt; set with sp_dboption 16 no chkpt on recovery; set with sp_dboption 32 Crashed while the database was being loaded; instructs recovery not to proceed 64 Database not recovered yet 128 Database is in recovery 256 Database is suspect; cannot be opened or used in its present state 1024 read only; set with sp_dboption 2048 dbo use only; set with sp_dboption 4096 single user; set with sp_dboption 8192 Database being checkpointed 16384 ANSI null default; set with sp_dboption 32768 Emergency mode |
version | smallint | Internal version number of the SQL Server code with which the database was created. |
logptr | int | Pointer to the transaction log. |
crdate | datetime | Creation date. |
dumptrdate | datetime | Date of the last DUMP TRANSACTION. |
category | int | Used for publication and subscription databases. |
sysdatabases clustered, unique on name
ncsysdatabases nonclustered, unique on dbid
sp_addlogin | sp_dboption | sp_helpdb |
sp_addpublication | sp_defaultdb | sp_logdevice |
sp_changearticle | sp_devoption | sp_renamedb |
sp_changedbowner | sp_dropdevice | sp_spaceused |
sp_changepublication | sp_droplogin | sp_tables |
sp_databases | ||