APPLIES TO: noSQL Server noAzure SQL Database yesAzure Synapse Analytics (SQL DW) yesParallel Data Warehouse

Returns the ID of the current SQL Data Warehouse or Parallel Data Warehouse session.

Topic link icon Transact-SQL Syntax Conventions (Transact-SQL)


-- Azure SQL Data Warehouse and Parallel Data Warehouse  

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 SQL commands.

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


The following example returns the current session ID.


See Also

DB_NAME (Transact-SQL)
VERSION (SQL Data Warehouse)