ABC.com has a SQL Server 2012 database instance that hosts a database named ComDB. The
ComDB database has a table named Partners that was created using the following Transact-SQL
code:
CREATE TABLE [dbo].[Partners]
(
[CompanyID] [int] NOT NULL,
[CompanyName] [nvarchar] (50) NOT NULL,
[Location] [nvarchar] (50) NOT NULL,
[ContactName] [nvarchar] (50) NOT NULL,
[Email] [nvarchar] (50) NOT NULL,
[Phone] [nvarchar] (10) NOT NULL,
CONSTRAINT [PK_Partners] PRIMARY KEY CLUSTERED
(
[CompanyID] ASC
)
ON PRIMARY
)
You want to create a FOR UPDATE trigger that will track changes to the ContactName and Phone
columns.
Which of the following statements should you use in the trigger definition?
A.
IF COLUMNS_UPDATED (ContactName, Phone)
B.
IF COLUMNS_UPDATED (ContactName) OR COLUMNS_UPDATED (Phone)
C.
IF UPDATED (ContactName, Phone).
D.
IF UPDATED (ContactName) OR UPDATED (Phone)
Explanation:
should be
IF UPDATE (ContactName) OR UPDATE (Phone)
http://msdn.microsoft.com/en-us/library/ms187326.aspx
Yes, there is typo, should be UPDATE(ContactName) OR UPDATE(Phone), but all other answers are incorrect, so have to choose “D” as correct.
d