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?

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
Answer D
1
0
I think that C is the better choice. UPDATE() will catch any attempt (even if unsuccessful) to UPDATE while COLUMNS_UPDATED tests for the successful action…
0
1
D is the correct answer, to check whether a column has been updated or inserted use the UPDATE() or INSERT().
1
0
By the way, part of new 200Q 70-461 dumps are available here:
https://drive.google.com/open?id=0B-ob6L_QjGLpfnJldlZxTklTaHM0akpJUzhja2pETHJOS0owMzd4eVk1UTVNQUpvdlVxVWM
Best Regards!
0
0
D
1
0