Updated: November 10, 2015
Applies To: Azure SQL Database, SQL Server 2014, SQL Server 2016 Preview
Returns a row for each user table in SQL Server.
Applies to: SQL Server (SQL Server 2008 through current version), Azure SQL Database, Azure SQL Data Warehouse Public Preview.
For a list of columns that this view inherits, see sys.objects (Transact-SQL).
A nonzero value is the ID of the data space (filegroup or partition scheme) that holds the large object binary (LOB) data for this table. Examples of LOB data types include varbinary(max), varchar(max), geography, or xml.
0 = The table does not LOB data.
Is the data space ID for a FILESTREAM filegroup or a partition scheme that consists of FILESTREAM filegroups.
To report the name of a FILESTREAM filegroup, execute the query SELECT FILEGROUP_NAME (filestream_data_space_id) FROM sys.tables.
sys.tables can be joined to the following views on filestream_data_space_id = data_space_id.
Maximum column ID ever used by this table.
Table is locked on bulk load. For more information, see sp_tableoption (Transact-SQL).
Table was created with the SET ANSI_NULLS database option ON.
1 = Table is published using snapshot replication or transactional replication.
1 = Table has a replication filter.
1 = Table is published using merge replication.
1 = Table is subscribed using an immediate updating subscription.
1 = Table contains persisted data that depends on an assembly whose definition changed during the last ALTER ASSEMBLY. Will be reset to 0 after the next successful DBCC CHECKDB or DBCC CHECKTABLE.
The maximum bytes allowed for text in row.
0 = Text in row option is not set. For more information, see sp_tableoption (Transact-SQL).
1 = Large value types are stored out-of-row. For more information, see sp_tableoption (Transact-SQL).
1 = Table is enabled for change data capture. For more information, see sys.sp_cdc_enable_table (Transact-SQL).
The value of the LOCK_ESCALATION option for the table:
0 = TABLE
1 = DISABLE
2 = AUTO
A text description of the lock_escalation option for the table. Possible values are: TABLE, AUTO, and DISABLE.
1 = Table is a FileTable.
For more information about FileTables, see FileTables (SQL Server).
The following are possible values:
0 = SCHEMA_ONLY
1 = SCHEMA_AND_DATA
The value of 0 is the default value.
The following are the possible values:
The value of SCHEMA_AND_DATA indicates that the table is a durable, in-memory table. SCHEMA_AND_DATA is the default value for memory optimized tables. The value of SCHEMA_ONLY indicates that the table data will not be persisted upon restart of the database with memory optimized objects.
The following are the possible values:
0 = not memory optimized.
1 = is memory optimized.
A value of 0 is the default value.
Memory optimized tables are in-memory user tables, the schema of which is persisted on disk similar to other user tables. Memory optimized tables can be accessed from natively compiled stored procedures.
The numeric value representing the type of table:
0 = NON_TEMPORAL_TABLE
1 = HISTORY_TABLE
2 = SYSTEM_VERSIONED_TEMPORAL_TABLE
The text description of the type of table:
Indicates whether the table is Stretch-enabled.
0 = The table is not Stretch-enabled.
1 = The table is Stretch-enabled.
For more info, see Stretch Database.
Indicates the migration state of the table.
0 = DISABLED. The table is not Stretch-enabled.
1 = ENABLED_MIGRATION_OFF. The table is Stretch-enabled, but data migration is off.
2 = ENABLED_MIGRATION_ON. The table is Stretch-enabled, and data migration is on.
Contains the description for the value of remote_data_archive_migration_state.
DISABLED = 0. The table is not Stretch-enabled.
ENABLED_MIGRATION_OFF = 1. The table is Stretch-enabled, but data migration is off.
ENABLED_MIGRATION_ON = 2. The table is Stretch-enabled, and data migration is on.
The visibility of the metadata in catalog views is limited to securables that a user either owns or on which the user has been granted some permission. For more information, see Metadata Visibility Configuration.
The following example returns all of the user tables that do not have a primary key.
SELECT SCHEMA_NAME(schema_id) AS schema_name ,name AS table_name FROM sys.tables WHERE OBJECTPROPERTY(object_id,'TableHasPrimaryKey') = 0 ORDER BY schema_name, table_name; GO
The following example shows how related temporal data can be exposed.
Applies to: SQL Server 2016 Community Technology Preview 3 (CTP 3.0) through SQL Server 2016.
SELECT T1.object_id, T1.name as TemporalTableName, SCHEMA_NAME(T1.schema_id) AS TemporalTableSchema, T2.name as HistoryTableName, SCHEMA_NAME(T2.schema_id) AS HistoryTableSchema, T1.temporal_type_desc FROM sys.tables T1 LEFT JOIN sys.tables T2 ON T1.history_table_id = T2.object_id ORDER BY T1.temporal_type desc