Most recently I had to create a SQL Logon trigger that set a limit to sessions a user could open in SQL Server.
For example, I log into SSMS and cannot open more than 10 sessions. This logon trigger will enforce that I don’t exceed 10 concurrent sessions.
The script below is what I came up with. It’s fairly straight-forward. At the bottom of the query you will see 2 SELECT statements:
- sys.triggers – You will find database level triggers here.
- sys.server_triggers – You will find server level triggers here.
Feel free to modify the script below to suit your specific needs.[snippet id=”35″]