cancel
Showing results for 
Search instead for 
Did you mean: 

User info in EVENTS: Connect, Disconnect, ConnectFailed

Former Member
3,018

Is it possible, within events triggered by "Connect, Disconnect and ConnectFailed" to determine more than the User name? The application we use login with a general userid but we would like to register OsUser and AppInfo.

Selecting the @@spid within the events does not result in a "normal" @@spid but in a large number, (1000490334) that increases for every login attempt.

The Database runs on 11.0.1 so I cannot use the ParentConnection property introduced in version 12.0

Accepted Solutions (1)

Accepted Solutions (1)

VolkerBarth
Contributor

Have a look at the EVENT_PARAMETER function. It notes all these context information available within the different system events.

For example, all these connection events you're interested in should give you the APPINFO information of the triggering connection when you query

SELECT EVENT_PARAMETER('APPINFO');

within your event handlers.

Also...

SELECT CONNECTION_PROPERTY ( 
   'whatever-property-you-want', 
   EVENT_PARAMETER ( 'ConnectionID' ) );
VolkerBarth
Contributor
0 Kudos

@Breck: Great enhancement!

Answers (0)