Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Each trigger applies to UPDATES as well as INSERTS, should use microsoft SQL 200

ID: 3546718 • Letter: E

Question

Each trigger applies to UPDATES as well as INSERTS, should use microsoft SQL 2008

A trigger that insures that the ASSIGN_HOURS field from table "Assignment" contains a value that is at least .5 hours and less than 10.0 hours

A trigger that insures that the field HIRE_DATE from table EMPLOYEE is not after the current date. Use the getdate() function to determine the current date.

A trigger that insures that the job code in the EMPLOYEE table is a valid job code from the job table. Here is what an example job code looks like ex: "201"

Explanation / Answer

CREATE TRIGGER TRIG_ASSIGN_HOURS

on Assignment AFTER INSERT,UPDATE

AS

BEGIN

DECLARE @ASSIGN_HOURS INT

SELECT @ASSIGN_HOURS=ASSIGN_HOURS FROM INSERTED

if @ASSIGN_HOURS < 0.5 and @ASSIGN_HOURS > 10 then

begin

rollback

RAISERROR(

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote