Skip to content

Latest commit

 

History

History
49 lines (36 loc) · 1.84 KB

File metadata and controls

49 lines (36 loc) · 1.84 KB
title SESSION_ID (Transact-SQL)
description SESSION_ID (Transact-SQL)
author VanMSFT
ms.author vanto
ms.date 02/23/2018
ms.service sql
ms.subservice t-sql
ms.topic reference
dev_langs
TSQL
monikerRange >= aps-pdw-2016 || = azure-sqldw-latest

SESSION_ID (Transact-SQL)

[!INCLUDEapplies-to-version/asa-pdw]

Returns the ID of the current [!INCLUDEssazuresynapse-md] or [!INCLUDEssPDW_md] session.

:::image type="icon" source="../../includes/media/topic-link-icon.svg" border="false"::: Transact-SQL syntax conventions

Syntax

-- Azure Synapse Analytics and Parallel Data Warehouse  
SESSION_ID ( )  

Return Value

Returns an nvarchar(32) value.

General Remarks

The session ID is assigned to each user connection when the connection is made. It persists for the duration of the connection. When the connection ends, the session ID is released.

The session ID begins with the alphabetical characters 'SID'. These are case-sensitive and must be capitalized when session ID is used in [!INCLUDEDWsql] commands.

You can query the view sys.dm_pdw_exec_sessions to retrieve the same information as this function.

Examples

The following example returns the current session ID.

SELECT SESSION_ID();  

See Also

DB_NAME (Transact-SQL)
VERSION (Azure Synapse Analytics)