1. Learn
  2. /
  3. Courses
  4. /
  5. Building and Optimizing Triggers in SQL Server

Exercise

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.

Instructions 1/2

undefined XP
    1
    2
  • Create the INSERT statement that is going to fill in user details in the ServerLogonLog table.
  • Select only the details for the situation when the session_id is the same as the @@SPID (ID of the current user).