ComeçarComece de graça

Enhancing database security

Recently, several inconsistencies have been discovered on the Fresh Fruit Delivery company's database server.

The IT Security team does not have an auditing process to find out when users are connecting to the database and track breaking changes back to the responsible user.

You are asked to help the Security team by implementing a new trigger based on their requirements.

Due to the complexity of this request, you should build the INSERT statement in the first step and use it to create the trigger in the second step.

Este exercício faz parte do curso

Building and Optimizing Triggers in SQL Server

Ver curso

Exercício interativo prático

Experimente este exercício completando este código de exemplo.

-- Save user details in the audit table
INSERT INTO ___ (___, ___, ___, ___)
SELECT ORIGINAL_LOGIN(), GETDATE(), @@SPID, client_net_address
-- The user details can be found in SYS.DM_EXEC_CONNECTIONS
FROM SYS.DM_EXEC_CONNECTIONS WHERE ___ = @@SPID;
Editar e executar o código