notebook/IT/SQL/SCRIPTS SQL QSA ORSYS/Demo déclencheur DDL LOGON.sql

14 lines
311 B
MySQL
Raw Normal View History

2020-11-26 17:38:25 +00:00
CREATE TRIGGER E_LOGON_LIMIT_SA
ON ALL SERVER
FOR LOGON
AS
BEGIN
IF EXISTS(SELECT 1
FROM sys.dm_exec_sessions
WHERE is_user_process = 1
AND ORIGINAL_LOGIN()= 'sa'
AND original_login_name = 'sa'
HAVING COUNT(*) > 1)
ROLLBACK;
END;