PrepAway - Latest Free Exam Questions & Answers

You develop a Microsoft SQL Server database that contains a table named Products. The Products table has the f

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



You need to create an audit record only when either the RetailPrice or WholeSalePrice column is updated.

Which Transact-SQL query should you use?

A. CREATE TRIGGER TrgPriceChange

ON Products FOR UPDATE

AS

IF COLUMNS_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

Reference: http://msdn.microsoft.com/en-us/library/bb510663.aspx

Reference: http://msdn.microsoft.com/en-us/library/ms186329.aspx


Leave a Reply