PrepAway - Latest Free Exam Questions & Answers

Category: 70-433 (v.1)

Exam 70-433: TS: Microsoft SQL Server 2008, Database Development (update October 11th, 2015)

Which trigger syntax should you use?

Click the Exhibit button.

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 TransactSQL
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 TransactSQL
statement in a trigger. Which trigger syntax should you use?

Which TransactSQL statement should you use?

Your database contains two tables named Order and OrderDetails that store order information. They
relate to each other using the OrderID column in each table. Your business requires that the
LastModifiedDate column in the Order table must reflect the date and time when a change is made
in the OrderDetails table for the related order.

You need to create a trigger to implement this business requirement.
Which TransactSQL statement should you use?

What should be the expected outcome?

You have tables named Products and OrderDetails. The Products table has a foreign key relationship
with the OrderDetails table on the ProductID column. You have the following TransactSQL
batch:
BEGIN TRY
BEGIN TRANSACTION
DELETE FROM Products WHERE ProductID = 5;
BEGIN TRANSACTION
INSERT INTO OrderDetails
( OrderID, ProductID, Quantity )
VALUES
( 1234, 5, 12 );
COMMIT TRANSACTION
COMMIT TRANSACTION
END TRY
BEGIN CATCH
ROLLBACK TRANSACTION
PRINT ERROR_MESSAGE();
END CATCH
You need to analyze the result of executing this batch. What should be the expected outcome?


Page 3 of 1512345...10...Last »