PrepAway - Latest Free Exam Questions & Answers

Which Transact-SQL statement should you use?

You use a Microsoft SQL Server 2012 database that contains a table named BlogEntry that has
the following columns. Id is the Primary Key. You need to append the “This is in a draft stage” string
to the Summary column of the recent 10 entries based on the values in EntryDateTime. Which
Transact-SQL statement should you use?

PrepAway - Latest Free Exam Questions & Answers

A.
UPDATE TOP(10) BlogEntry
SET Summary.WRITE(N’ This is in a draft stage’, NULL, 0)

B.
UPDATE BlogEntry
SET Summary = CAST(N’ This is in a draft stage’ as nvarchar(max))
WHERE Id IN(SELECT TOP(10) Id
FROM BlogEntry ORDER BY EntryDateTime DESC)

C.
UPDATE BlogEntry
SET Summary.WRITE(N’ This is in a draft stage’, NULL, 0)
FROM (
SELECT TOP(10) Id FROM BlogEntry ORDER BY EntryDateTime DESC)
AS s
WHERE BlogEntry.Id = s.ID

D.
UPDATE BlogEntrySET
Summary.WRITE(N’ This is in a draft stage’, 0, 0)
WHERE Id IN(SELECT TOP(10) Id FROM BlogEntry ORDER BY EntryDateTime
DESC)

Explanation:
According to the append possibility of .Write method when offset is specified as NULL.
https://msdn.microsoft.com/en-us/library/ms177523.aspx


Leave a Reply