--- description: "sys.sysdatabases (Transact-SQL)" title: "sys.sysdatabases (Transact-SQL) | Microsoft Docs" ms.custom: "" ms.date: "03/15/2017" ms.prod: sql ms.prod_service: "database-engine, sql-database, synapse-analytics, pdw" ms.reviewer: "" ms.technology: system-objects ms.topic: "reference" f1_keywords: - "sysdatabases_TSQL" - "sys.sysdatabases_TSQL" - "sys.sysdatabases" - "sysdatabases" dev_langs: - "TSQL" helpviewer_keywords: - "sys.sysdatabases compatibility view" - "sysdatabases system table" ms.assetid: 60a93880-62f1-4eda-a886-f046706ba90c author: rwestMSFT ms.author: randolphwest monikerRange: ">=aps-pdw-2016||=azure-sqldw-latest||>=sql-server-2016||>=sql-server-linux-2017||=azuresqldb-mi-current" --- # sys.sysdatabases (Transact-SQL) [!INCLUDE [sql-asdbmi-asa-pdw](../../includes/applies-to-version/sql-asdbmi-asa-pdw.md)] Contains one row for each database in an instance of [!INCLUDE[msCoName](../../includes/msconame-md.md)] [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)]. When [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] is first installed, **sysdatabases** contains entries for the **master**, **model**, **msdb**, and **tempdb** databases. > [!IMPORTANT] > [!INCLUDE[ssnoteCompView](../../includes/ssnotecompview-md.md)] |Column name|Data type|Description| |-----------------|---------------|-----------------| |**name**|**sysname**|Database name| |**dbid**|**smallint**|Database ID| |**sid**|**varbinary(85)**|System ID of the database creator| |**mode**|**smallint**|Used internally for locking a database while it is being created.| |**status**|**int**|Status bits, some of which can be set by using [ALTER DATABASE](../../t-sql/statements/alter-database-transact-sql.md) as noted:

1 = **autoclose** (ALTER DATABASE)

4 = **select into/bulkcopy** (ALTER DATABASE using SET RECOVERY)

8 = **trunc. log on chkpt** (ALTER DATABASE using SET RECOVERY)

16 = **torn page detection** (ALTER DATABASE)

32 = **loading**

64 = **pre recovery**

128 = **recovering**

256 = **not recovered**

512 = **offline** (ALTER DATABASE)

1024 = **read only** (ALTER DATABASE)

2048 = **dbo use only** (ALTER DATABASE using SET RESTRICTED_USER)

4096 = **single user** (ALTER DATABASE)

32768 = **emergency mode**

65536 = **CHECKSUM** (ALTER DATABASE)

4194304 = **autoshrink** (ALTER DATABASE)

1073741824 = **cleanly shutdown**

Multiple bits can be ON at the same time.| |**status2**|**int**|16384 = **ANSI null default** (ALTER DATABASE)

65536 = **concat null yields null** (ALTER DATABASE)

131072 = **recursive triggers** (ALTER DATABASE)

1048576 = **default to local cursor** (ALTER DATABASE)

8388608 = **quoted identifier** (ALTER DATABASE)

33554432 = **cursor close on commit** (ALTER DATABASE)

67108864 = **ANSI nulls** (ALTER DATABASE)

268435456 = **ANSI warnings** (ALTER DATABASE)

536870912 = **full text enabled** (set by using **sp_fulltext_database**)| |**crdate**|**datetime**|Creation date| |**reserved**|**datetime**|Reserved for future use.| |**category**|**int**|Contains a bitmap of information used for replication:

1 = Published for snapshot or transactional replication.

2 = Subscribed to a snapshot or transactional publication.

4 = Published for merge replication.

8 = Subscribed to a merge publication.

16 = Distribution database.| |**cmptlevel**|**tinyint**|Compatibility level for the database. For more information, see [ALTER DATABASE Compatibility Level (Transact-SQL)](../../t-sql/statements/alter-database-transact-sql-compatibility-level.md).| |**filename**|**nvarchar(260)**|Operating-system path and name for the primary file for the database.

**filename** is visible to **dbcreator**, **sysadmin**, the database owner with CREATE ANY DATABASE permissions, or grantees that have any one of the following permissions: ALTER ANY DATABASE, CREATE ANY DATABASE, VIEW ANY DEFINITION. To return the path and file name, query the [sys.sysfiles](../../relational-databases/system-compatibility-views/sys-sysfiles-transact-sql.md) compatibility view, or the [sys.database_files](../../relational-databases/system-catalog-views/sys-database-files-transact-sql.md) view.| |**version**|**smallint**|Internal version number of the [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] code with which the database was created. [!INCLUDE[ssInternalOnly](../../includes/ssinternalonly-md.md)]| ## See Also [ALTER DATABASE (Transact-SQL)](../../t-sql/statements/alter-database-transact-sql.md) [Mapping System Tables to System Views (Transact-SQL)](../../relational-databases/system-tables/mapping-system-tables-to-system-views-transact-sql.md) [Compatibility Views (Transact-SQL)](~/relational-databases/system-compatibility-views/system-compatibility-views-transact-sql.md)