Logon triggers - using EVENTDATA() versus system functions (SUSER_SNAME() etc.)

  • Which is the preferred way of writing a logon trigger for basic user authentication?

    Using the EVENTDATA() function and extracting the connection information from the XML or using system functions like this?

    select HOST_NAME(),APP_NAME(),SUSER_SNAME(),USER_NAME(),SCHEMA_NAME()

    __________________________________________________________________________________
    SQL Server 2016 Columnstore Index Enhancements - System Views for Disk-Based Tables[/url]
    Persisting SQL Server Index-Usage Statistics with MERGE[/url]
    Turbocharge Your Database Maintenance With Service Broker: Part 2[/url]

  • If it's just Logon Inforamtion you wish to capture then go for the System Functions.

    I don't see the point of EVENTDATA() for your requirement. The System Functions will also perform better because the information is extracted from the SQL Srver's System Tables.


    Kindest Regards,

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply