sp_logintrigger

Sets and displays 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.

Syntax

sp_logintrigger 'global login trigger name'

Parameters

Examples

Usage

To find out if a global login trigger is defined and enabled, use the @@logintrigger global variable.

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.

Permissions

The permission checks for sp_logintrigger differ based on your granular permissions settings.

SettingDescription
Enabled

With granular permissions enabled, you must be a user with manage security configuration privilege to set a new login trigger.

Any user can execute sp_logintrigger to display the current global login trigger.

Disabled

With granular permissions disabled, you must be a user with sso_role to set a new login trigger.

Any user can execute sp_logintrigger to display the current global login trigger.