PrepAway - Latest Free Exam Questions & Answers

Which Transact-SQL query should you use?

You develop a Microsoft SQL Server 2012 database that contains a table named Products. The Products table
has the following definition:

You need to create an audit record only when eitherthe RetailPrice or WholeSalePrice column is updated.
Which Transact-SQL query should you use?

PrepAway - Latest Free Exam Questions & Answers

A.
CREATE TRIGGER TrgPriceChange ON Products FOR UPDATE AS
IF CCLUMNS_CHANGED(RetailPrice, WholesalePrice)
– – Create Audit Records

B.
CREATE TRIGGER TrgPriceChange ON Products FOR UPDATE AS
IF EXISTS(SELECT RetailPrice from inserted) OR
EXISTS (SELECT WholeSalePnce FROM inserted)
– – Create Audit Records

C.
CREATE TRIGGER TrgPriceChange ON Products FOR UPDATE AS
IF COLUMNS_UPDATED(RetailPrice, WholesalePrice)
– – Create Audit Records

D.
CREATE TRIGGER TrgPriceChange ON Products FOR UPDATE AS
IF UPDATE(RetailPrice) OR UPDATE(WholeSalePrice)
– – Create Audit Records

Explanation:
Verified answer as correct.
Reference: http://msdn.microsoft.com/en-us/library/bb510663.aspx
Reference: http://msdn.microsoft.com/en-us/library/ms186329.aspx

5 Comments on “Which Transact-SQL query should you use?


Leave a Reply