nerdexam
Microsoft

70-433 · Question #68

You are developing a database using Microsoft SQL Server 2008. The database contains the tables shown in the exhibit. You are required to prevent parts from being deleted if they belong to a kit. If…

The correct answer is B. CREATE TRIGGER tr_Part_d ON Part. See the full explanation below for the reasoning.

Question

You are developing a database using Microsoft SQL Server 2008. The database contains the tables shown in the exhibit. You are required to prevent parts from being deleted if they belong to a kit. If a part belongs to a kit, the delete should not occur and the IsDeleted column for the row should be changed to 'True'. Parts can be deleted if they do not belong to a kit. You have the following Transact-SQL statement to be used in a trigger:

UPDATE p SET IsDeleted = 1 FROM KitPart kp JOIN deleted d ON kp.PartID = d.PartID JOIN Part p ON kp.PartID = p.PartID; DELETE FROM p FROM Part p JOIN deleted d ON p.PartID = d.PartID LEFT OUTER JOIN KitPart kp ON p.PartID = kp.PartID WHERE kp.KitID IS NULL; You need to implement the Transact-SQL statement in a trigger. Which trigger syntax should you use?

Exhibit

70-433 question #68 exhibit

Options

  • ACREATE TRIGGER tr_Part_d ON Part
  • BCREATE TRIGGER tr_Part_d ON Part
  • CCREATE TRIGGER tr_KitPart_d ON KitPart
  • DCREATE TRIGGER tr_KitPart_d ON KitPart

How the community answered

(47 responses)
  • A
    2% (1)
  • B
    83% (39)
  • C
    11% (5)
  • D
    4% (2)

Community Discussion

No community discussion yet for this question.

Full 70-433 Practice