sp_logintrigger is the new procedure that can be used to set and display the global login trigger. This global login trigger has the same characteristics as a personal login script. It is executed before any personal login script for every user that tries to log in, including system administrators and security officers.
sp_logintrigger <global login trigger name>
is the name of the global login trigger.
If no parameter is included, sp_logintrigger displays the current login trigger status and name if it exists, and no rows if there is no global login trigger defined.
To set a global login trigger using sp_logintrigger:
sp_logintrigger 'master.dbo.myproc'
To view an updated global login trigger:
1> sp_logintrigger 2> go Global login trigger Status ---------------------------------- ------- sybsystemprocs.dbo.myproc Enabled (1 row affected) (return status = 0
When a global login trigger does not exist:
1> sp_logintrigger 2> go Global login trigger Status -------------------- ------ (0 rows affected)
To delete a global login trigger that was specified earlier with sp_logintrigger, enter:
sp_logintrigger 'drop'
A new global variable @@logintrigger is used to find out if a global login trigger is defined and enabled.
There is a difference between this global login and the private login script. This global login trigger is stored by name in sysattributes, while the private login script is stored only by object ID.
Everyone can execute sp_logintrigger to display the current global login trigger. To set a new login trigger, SSO role is required.