| title | sys.fn_MSxe_read_event_stream (Transact-SQL) | ||||
|---|---|---|---|---|---|
| description | sys.fn_MSxe_read_event_stream (Transact-SQL) | ||||
| author | rwestMSFT | ||||
| ms.author | randolphwest | ||||
| ms.reviewer | dfurman | ||||
| ms.date | 09/10/2025 | ||||
| ms.service | sql | ||||
| ms.subservice | system-objects | ||||
| ms.topic | reference | ||||
| f1_keywords |
|
||||
| helpviewer_keywords |
|
||||
| dev_langs |
|
[!INCLUDE SQL Server SQL Database SQL Managed Instance]
sys.fn_MSxe_read_event_stream returns binary data for internal use by the QueryableXEventData .NET class. Extended Events UI in the [!INCLUDE ssManStudioFull] (SSMS) uses this class to read event session data.
To view human-readable event data, use one of the following instead of calling sys.fn_MSxe_read_event_stream directly:
- Extended Events UI in SSMS.
- sys.fn_xe_file_target_read_file table-valued function.
:::image type="icon" source="../../includes/media/topic-link-icon.svg" border="false"::: Transact-SQL syntax conventions
sys.fn_MSxe_read_event_stream ( source , source_option )
The specific source of event data returned by the function. Source is nvarchar(260) with no default.
Source is interpreted differently depending on the value of source_option:
| source_option | Interpretation of source |
|---|---|
0 |
Source is the name of a started event session. |
1 |
Source is the path to the event session log files to read. When used with files in the local file system, source must include the name of an event session log file and can contain * as a wildcard.When used with blobs in an Azure Storage container, source is an HTTP URL constructed by the concatenation of two parts: 1. The path to an Azure Storage storage container, followed by a slash ( /).2. A common prefix for the names of blobs in the container that should be read. For example, using https://<storage-account-name>.blob.core.windows.net/container-name>/xe_session as source retrieves data from all blobs with names starting with xe_session, and regardless of the remainder of the blob name including the extension. Wildcards can't be specified. A credential allowing access to the Azure Storage container must exist. |
The option that determines the type of the event data source. Possible values are:
| Value | Description |
|---|---|
0 |
Returns event data from the event_stream target of a started event session. The function executes indefinitely, returning new event data as the session produces it. |
1 |
Returns event data from the extended event log files specified by source. |
| Column name | Data type | Description |
|---|---|---|
| type | int | The event type. Not nullable. |
| data | image | Binary event data. Is nullable. |