Limitar conexiones concurrentes

CREATE TRIGGER LimitarConexiones
ON ALL SERVER WITH EXECUTE AS 'loginName'
FOR LOGON
AS
BEGIN
    IF ORIGINAL_LOGIN()= 'loginName'
    AND (
        SELECT COUNT(*)
        FROM sys.dm_exec_sessions
        WHERE is_user_process = 1
        AND original_login_name = 'loginName'
    ) > 3
    ROLLBACK;
END;

No hay comentarios:

Publicar un comentario