Sunday, January 24, 2010

Logon Triggers

You can use this approach if you want to audit any logon by user to Sql Server instance but note that the Logon triggers are fired after authentication succeeds but before the user session is actually established. And You also limit the number of connections that a user is allowed to make to the instance.
Let's see this example:
1. Create a test user with public access



2. Create a logon trigger which do the following:



3. Now If you try to login by "TestUser" , you will get an error message as below:



4. To disable this trigger you can run this command:

No comments: