USE THE AdventureWorks2012 sample database to answer the questions
Posted: Mon Jun 06, 2022 11:17 am
USE THE AdventureWorks2012 sample database to answer the questions
4. Complete the following queries as a batch. Make sure the check if the trigger already exists. If so, drop it first. a. Write a query that creates a FOR trigger (Human Resources. Trigger CheckModifedDate) that checks the modified date. It ensures that during the insert of a new department, the modified date is the current day. If it is not, the row is updated, setting ModifiedDate to the current date and time. The trigger uses the Human Resources Department table in Adventure Works 2012 database. (15 points) Command(s) completed successfully. b. Insert the following row to the Human Resources Department table: ('Information Systems', 'Operations', '12/05/2016'). Retrieve the modified record from the table. Your table should show today's date and time in the record. (5 points)
4. Complete the following queries as a batch. Make sure the check if the trigger already exists. If so, drop it first. a. Write a query that creates a FOR trigger (Human Resources. Trigger CheckModifedDate) that checks the modified date. It ensures that during the insert of a new department, the modified date is the current day. If it is not, the row is updated, setting ModifiedDate to the current date and time. The trigger uses the Human Resources Department table in Adventure Works 2012 database. (15 points) Command(s) completed successfully. b. Insert the following row to the Human Resources Department table: ('Information Systems', 'Operations', '12/05/2016'). Retrieve the modified record from the table. Your table should show today's date and time in the record. (5 points)