Friday, February 24, 2012 8:50 PM
I know Extended Stored Procedures are yesterday's news, but they still have their place.
Does anyone know how to get the current Connection ID from inside an Extended Stored Procedure?
- Edited by Neil.W Friday, February 24, 2012 8:52 PM
Monday, February 27, 2012 3:03 AMModerator
You could use a combination of Session ID, Host Name ,Login Name and login_time to get a distinct connection id from sys.dm_exec_connections and sys.dm_exec_sessions.
This information can be obtained from
select a.session_id, a.login_time, a.host_name, a.login_name, a.login_time,a.session_id,b.connection_id from sys.dm_exec_sessions a , sys.dm_exec_connections b where a.session_id=b.session_id
Please remember to click "Mark as Answer" on the post that helps you, and to click "Unmark as Answer" if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
- Marked As Answer by Peja TaoModerator Monday, March 05, 2012 1:30 AM