Skip to content

Commit 4893a0c

Browse files
Merge pull request #35963 from MicrosoftDocs/main
Auto Publish – main to live - 2025-11-28 23:30 UTC
2 parents bdc8b68 + 67cba48 commit 4893a0c

File tree

8 files changed

+351
-319
lines changed

8 files changed

+351
-319
lines changed
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
---
22
author: rwestMSFT
33
ms.author: randolphwest
4-
ms.date: 05/10/2023
4+
ms.date: 11/28/2025
55
ms.service: sql
66
ms.topic: include
77
---
8-
AdventureWorks2022
8+
AdventureWorks2025
Lines changed: 55 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
---
22
title: "sys.all_columns (Transact-SQL)"
3-
description: sys.all_columns (Transact-SQL)
3+
description: sys.all_columns shows the union of all columns belonging to user-defined objects and system objects.
44
author: rwestMSFT
55
ms.author: randolphwest
6-
ms.date: "05/24/2022"
6+
ms.date: 11/28/2025
77
ms.service: sql
88
ms.subservice: system-objects
99
ms.topic: "reference"
@@ -21,51 +21,58 @@ dev_langs:
2121
monikerRange: ">=aps-pdw-2016 || =azuresqldb-current || =azure-sqldw-latest || >=sql-server-2016 || >=sql-server-linux-2017 || =azuresqldb-mi-current || =fabric || =fabric-sqldb"
2222
---
2323
# sys.all_columns (Transact-SQL)
24+
2425
[!INCLUDE [sql-asdb-asdbmi-asa-pdw-fabricse-fabricdw-fabricsqldb](../../includes/applies-to-version/sql-asdb-asdbmi-asa-pdw-fabricse-fabricdw-fabricsqldb.md)]
2526

26-
Shows the union of all columns belonging to user-defined objects and system objects.
27-
28-
|Column name|Data type|Description|
29-
|-----------------|---------------|-----------------|
30-
|object_id|**int**|ID of the object to which this column belongs.|
31-
|name|**sysname**|Name of the column. Is unique within the object.|
32-
|column_id|**int**|ID of the column. Is unique within the object.<br /><br /> Column IDs might not be sequential.|
33-
|system_type_id|**tinyint**|ID of the system-type of the column.|
34-
|user_type_id|**int**|ID of the type of the column as defined by the user.<br /><br /> To return the name of the type, join to the [sys.types](../../relational-databases/system-catalog-views/sys-types-transact-sql.md) catalog view on this column.|
35-
|max_length|**smallint**|Maximum length (in bytes) of the column.<br /><br /> -1 = Column data type is **varchar(max)**, **nvarchar(max)**, **varbinary(max)**, or **xml**.<br /><br /> For **text** columns, the max_length value will be 16 or the value set by sp_tableoption 'text in row'.|
36-
|precision|**tinyint**|Precision of the column if numeric-based; otherwise, 0.|
37-
|scale|**tinyint**|Scale of the column if numeric-based; otherwise, 0.|
38-
|collation_name|**sysname**|Name of the collation of the column if character-based; otherwise, NULL.|
39-
|is_nullable|**bit**|1 = Column is nullable.|
40-
|is_ansi_padded|**bit**|1 = Column uses ANSI_PADDING ON behavior if character, binary, or variant.<br /><br /> 0 = Column is not character, binary, or variant.|
41-
|is_rowguidcol|**bit**|1 = Column is a declared ROWGUIDCOL.|
42-
|is_identity|**bit**|1 = Column has identity values|
43-
|is_computed|**bit**|1 = Column is a computed column.|
44-
|is_filestream|**bit**|1 = Column is declared to use filestream storage.|
45-
|is_replicated|**bit**|1 = Column is replicated.|
46-
|is_non_sql_subscribed|**bit**|1 = Column has a non-[!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] subscriber.|
47-
|is_merge_published|**bit**|1 = Column is merge-published.|
48-
|is_dts_replicated|**bit**|1 = Column is replicated by using [!INCLUDE[ssIS](../../includes/ssis-md.md)].|
49-
|is_xml_document|**bit**|1 = Content is a complete XML document.<br /><br /> 0 = Content is a document fragment, or the column data type is not XML.|
50-
|xml_collection_id|**int**|Non-zero if the column's data type is **xml** and the XML is typed. The value will be the ID of the collection containing the column's validating XML schema namespace<br /><br /> 0 = no XML schema collection.|
51-
|default_object_id|**int**|ID of the default object, regardless of whether it is a stand-alone [sys.sp_bindefault](../../relational-databases/system-stored-procedures/sp-bindefault-transact-sql.md), or an in-line, column-level DEFAULT constraint. The parent_object_id column of an inline column-level default object is a reference back to the table itself.<br /><br /> 0 = No default.|
52-
|rule_object_id|**int**|ID of the stand-alone rule bound to the column by using sys.sp_bindrule.<br /><br /> 0 = No stand-alone rule.<br /><br /> For column-level CHECK constraints, see [sys.check_constraints &#40;Transact-SQL&#41;](../../relational-databases/system-catalog-views/sys-check-constraints-transact-sql.md).|
53-
|is_sparse|bit|1 = Column is a sparse column. For more information, see [Use Sparse Columns](../../relational-databases/tables/use-sparse-columns.md).|
54-
|is_column_set|bit|1 = Column is a column set. For more information, see [Use Column Sets](../../relational-databases/tables/use-column-sets.md).|
55-
|generated_always_type|**tinyint**|**Applies to**: [!INCLUDE[sssql16-md](../../includes/sssql16-md.md)] and later, [!INCLUDE[ssSDS_md](../../includes/sssds-md.md)]. 7, 8, 9, 10 only applies to [!INCLUDE[ssSDS_md](../../includes/sssds-md.md)].<br /><br /> Identifies when the column value is generated (will always be 0 for columns in system tables):<br /><br /> 0 = NOT_APPLICABLE<br /> 1 = AS_ROW_START<br /> 2 = AS_ROW_END<br />7 = AS_TRANSACTION_ID_START<br />8 = AS_TRANSACTION_ID_END<br />9 = AS_SEQUENCE_NUMBER_START<br />10 = AS_SEQUENCE_NUMBER_END<br /><br /> For more information, see [Temporal Tables &#40;Relational databases&#41;](../../relational-databases/tables/temporal-tables.md).|
56-
|generated_always_type_desc|**nvarchar(60)**|**Applies to**: [!INCLUDE[sssql16-md](../../includes/sssql16-md.md)] and later, [!INCLUDE[ssSDS_md](../../includes/sssds-md.md)].<br /><br /> Textual description of `generated_always_type`'s value (always NOT_APPLICABLE for columns in system tables) <br /><br /> NOT_APPLICABLE<br /> AS_ROW_START<br /> AS_ROW_END<br /><br />**Applies to**: Starting with [!INCLUDE [sssql22-md](../../includes/sssql22-md.md)], [!INCLUDE[ssSDS_md](../../includes/sssds-md.md)]<br /><br />AS_TRANSACTION_ID_START<br />AS_TRANSACTION_ID_END<br />AS_SEQUENCE_NUMBER_START<br />AS_SEQUENCE_NUMBER_END|
57-
|ledger_view_column_type|**tinyint**|**Applies to**: Starting with [!INCLUDE [sssql22-md](../../includes/sssql22-md.md)], [!INCLUDE[ssSDS_md](../../includes/sssds-md.md)].<br /><br /> If not NULL, indicates the type of a column in a ledger view:<br /><br /> 1 = TRANSACTION_ID<br /> 2 = SEQUENCE_NUMBER<br /> 3 = OPERATION_TYPE<br /> 4 = OPERATION_TYPE_DESC<br/><br/>For more information on database ledger, see [Ledger](/azure/azure-sql/database/ledger-overview).|
58-
|ledger_view_column_type_desc|**nvarchar(60)**|**Applies to**: Starting with [!INCLUDE [sssql22-md](../../includes/sssql22-md.md)], [!INCLUDE[ssSDS_md](../../includes/sssds-md.md)].<br /><br /> If not NULL, contains a textual description of the type of a column in a ledger view:<br /><br /> TRANSACTION_ID<br /> SEQUENCE_NUMBER<br /> OPERATION_TYPE<br /> OPERATION_TYPE_DESC|
59-
60-
## Permissions
61-
[!INCLUDE[ssCatViewPerm](../../includes/sscatviewperm-md.md)] For more information, see [Metadata Visibility Configuration](../../relational-databases/security/metadata-visibility-configuration.md).
62-
63-
## See Also
64-
[Object Catalog Views &#40;Transact-SQL&#41;](../../relational-databases/system-catalog-views/object-catalog-views-transact-sql.md)
65-
[Catalog Views &#40;Transact-SQL&#41;](../../relational-databases/system-catalog-views/catalog-views-transact-sql.md)
66-
[Querying the SQL Server System Catalog FAQ](../../relational-databases/system-catalog-views/querying-the-sql-server-system-catalog-faq.yml)
67-
[sys.columns &#40;Transact-SQL&#41;](../../relational-databases/system-catalog-views/sys-columns-transact-sql.md)
68-
[sys.system_columns &#40;Transact-SQL&#41;](../../relational-databases/system-catalog-views/sys-system-columns-transact-sql.md)
69-
[sys.computed_columns &#40;Transact-SQL&#41;](../../relational-databases/system-catalog-views/sys-computed-columns-transact-sql.md)
70-
71-
27+
Shows the union of all columns belonging to user-defined objects and system objects.
28+
29+
| Column name | Data type | Description |
30+
| --- | --- | --- |
31+
| `object_id` | **int** | ID of the object to which this column belongs. |
32+
| `name` | **sysname** | Name of the column. Is unique within the object. |
33+
| `column_id` | **int** | ID of the column. Is unique within the object.<br /><br />Column IDs might not be sequential. |
34+
| `system_type_id` | **tinyint** | ID of the system-type of the column. |
35+
| `user_type_id` | **int** | ID of the type of the column as defined by the user.<br /><br />To return the name of the type, join to the [sys.types](sys-types-transact-sql.md) catalog view on this column. |
36+
| `max_length` | **smallint** | Maximum length (in bytes) of the column.<br /><br />`-1` = Column data type is **varchar(max)**, **nvarchar(max)**, **varbinary(max)**, or **xml**.<br /><br />For **text** columns, the `max_length` value is `16` or the value set by `sp_tableoption 'text in row'`. |
37+
| `precision` | **tinyint** | Precision of the column if numeric-based; otherwise, `0`. |
38+
| `scale` | **tinyint** | Scale of the column if numeric-based; otherwise, `0`. |
39+
| `collation_name` | **sysname** | Name of the collation of the column if character-based; otherwise, `NULL`. |
40+
| `is_nullable` | **bit** | `1` = Column is nullable. |
41+
| `is_ansi_padded` | **bit** | `1` = Column uses `ANSI_PADDING ON` behavior if character, binary, or variant.<br /><br />`0` = Column isn't character, binary, or variant. |
42+
| `is_rowguidcol` | **bit** | `1` = Column is a declared `ROWGUIDCOL`. |
43+
| `is_identity` | **bit** | `1` = Column has identity values |
44+
| `is_computed` | **bit** | `1` = Column is a computed column. |
45+
| `is_filestream` | **bit** | `1` = Column is declared to use FILESTREAM storage. |
46+
| `is_replicated` | **bit** | `1` = Column is replicated. |
47+
| `is_non_sql_subscribed` | **bit** | `1` = Column has a non-[!INCLUDE [ssNoVersion](../../includes/ssnoversion-md.md)] subscriber. |
48+
| `is_merge_published` | **bit** | `1` = Column is merge-published. |
49+
| `is_dts_replicated` | **bit** | `1` = Column is replicated by using [!INCLUDE [ssIS](../../includes/ssis-md.md)]. |
50+
| `is_xml_document` | **bit** | `1` = Content is a complete XML document.<br /><br />`0` = Content is a document fragment, or the column data type isn't XML. |
51+
| `xml_collection_id` | **int** | Non-zero if the column's data type is **xml** and the XML is typed. The value is the ID of the collection containing the column's validating XML schema namespace.<br /><br />`0` = no XML schema collection. |
52+
| `default_object_id` | **int** | ID of the default object, regardless of whether it's a stand-alone [sys.sp_bindefault](../system-stored-procedures/sp-bindefault-transact-sql.md), or an in-line, column-level `DEFAULT` constraint. The `parent_object_id` column of an inline column-level default object is a reference back to the table itself.<br /><br />`0` = No default. |
53+
| `rule_object_id` | **int** | ID of the stand-alone rule bound to the column by using `sys.sp_bindrule`.<br /><br />`0` = No stand-alone rule.<br /><br />For column-level `CHECK` constraints, see [sys.check_constraints](sys-check-constraints-transact-sql.md). |
54+
| `is_sparse` | **bit** | `1` = Column is a sparse column. For more information, see [Use sparse columns](../tables/use-sparse-columns.md). |
55+
| `is_column_set` | **bit** | `1` = Column is a column set. For more information, see [Use column sets](../tables/use-column-sets.md). |
56+
| `generated_always_type` | **tinyint** | Identifies when the column value is generated (always `0` for columns in system tables):<br /><br />`0` = `NOT_APPLICABLE`<br />`1` = `AS_ROW_START`<br />`2` = `AS_ROW_END`<br />`7` = `AS_TRANSACTION_ID_START`<br />`8` = `AS_TRANSACTION_ID_END`<br />`9` = `AS_SEQUENCE_NUMBER_START`<br />`10` = `AS_SEQUENCE_NUMBER_END`<br /><br />For more information, see [Temporal tables](../tables/temporal-tables.md).<br /><br />**Applies to**: [!INCLUDE [sssql16-md](../../includes/sssql16-md.md)] and later versions, and [!INCLUDE [ssSDS_md](../../includes/sssds-md.md)]. `7`, `8`, `9`, `10` only applies to [!INCLUDE [ssSDS_md](../../includes/sssds-md.md)]. |
57+
| `generated_always_type_desc` | **nvarchar(60)** | **Applies to**: [!INCLUDE [sssql16-md](../../includes/sssql16-md.md)] and later versions, and [!INCLUDE [ssSDS_md](../../includes/sssds-md.md)].<br /><br />Textual description of the `generated_always_type` value (always `NOT_APPLICABLE` for columns in system tables)<br /><br />`NOT_APPLICABLE`<br />`AS_ROW_START`<br />`AS_ROW_END`<br /><br />**Applies to**: [!INCLUDE [sssql22-md](../../includes/sssql22-md.md)] and later versions, and [!INCLUDE [ssSDS_md](../../includes/sssds-md.md)]<br /><br />`AS_TRANSACTION_ID_START`<br />`AS_TRANSACTION_ID_END`<br />`AS_SEQUENCE_NUMBER_START`<br />`AS_SEQUENCE_NUMBER_END` |
58+
| `ledger_view_column_type` | **tinyint** | If not `NULL`, indicates the type of a column in a ledger view:<br /><br />`1` = `TRANSACTION_ID`<br />`2` = `SEQUENCE_NUMBER`<br />`3` = `OPERATION_TYPE`<br />`4` = `OPERATION_TYPE_DESC`<br /><br />For more information on database ledger, see [Ledger](/azure/azure-sql/database/ledger-overview).<br /><br />**Applies to**: [!INCLUDE [sssql22-md](../../includes/sssql22-md.md)] and later versions, and [!INCLUDE [ssSDS_md](../../includes/sssds-md.md)]. |
59+
| `ledger_view_column_type_desc` | **nvarchar(60)** | If not `NULL`, contains a textual description of the type of a column in a ledger view:<br /><br />`TRANSACTION_ID`<br />`SEQUENCE_NUMBER`<br />`OPERATION_TYPE`<br />`OPERATION_TYPE_DESC`<br /><br />**Applies to**: [!INCLUDE [sssql22-md](../../includes/sssql22-md.md)] and later versions, and [!INCLUDE [ssSDS_md](../../includes/sssds-md.md)]. |
60+
| `is_dropped_ledger_column` | **bit** | Indicates a ledger table column that was dropped.<br /><br />**Applies to**: [!INCLUDE [sssql22-md](../../includes/sssql22-md.md)] and later versions, and [!INCLUDE [ssSDS_md](../../includes/sssds-md.md)] |
61+
| `vector_dimensions` | **int** | Indicates how many dimensions the vector has.<br /><br />**Applies to**: [!INCLUDE [sssql25-md](../../includes/sssql25-md.md)] and later versions, and [!INCLUDE [ssSDS_md](../../includes/sssds-md.md)] |
62+
| `vector_base_type` | **tinyint** | Indicates the data type used to store vector dimensions values.<br /><br />`0` = 32-bit (single-precision) float<br />`1` = 16-bit (half-precision) float <sup>1</sup><br /><br />**Applies to**: [!INCLUDE [sssql25-md](../../includes/sssql25-md.md)] and later versions, and [!INCLUDE [ssSDS_md](../../includes/sssds-md.md)] |
63+
| `vector_base_type_desc` | **nvarchar(10)** | Contains the textual description of the data type used to store vector dimensions values.<br /><br />**Applies to**: [!INCLUDE [sssql25-md](../../includes/sssql25-md.md)] and later versions, and [!INCLUDE [ssSDS_md](../../includes/sssds-md.md)] |
64+
65+
<sup>1</sup> For more information, see [Half-precision floating-point format](https://wikipedia.org/wiki/Half-precision_floating-point_format).
66+
67+
## Permissions
68+
69+
[!INCLUDE [ssCatViewPerm](../../includes/sscatviewperm-md.md)] For more information, see [Metadata visibility configuration](../security/metadata-visibility-configuration.md).
70+
71+
## Related content
72+
73+
- [Object catalog views (Transact-SQL)](object-catalog-views-transact-sql.md)
74+
- [System catalog views (Transact-SQL)](catalog-views-transact-sql.md)
75+
- [Querying the SQL Server System Catalog FAQ](querying-the-sql-server-system-catalog-faq.yml)
76+
- [sys.columns (Transact-SQL)](sys-columns-transact-sql.md)
77+
- [sys.system_columns (Transact-SQL)](sys-system-columns-transact-sql.md)
78+
- [sys.computed_columns (Transact-SQL)](sys-computed-columns-transact-sql.md)

0 commit comments

Comments
 (0)