Microsoft Exam Questions

Which Transact-SQL statement should you use?

Note: This question is part of a series of questions that use the same scenario. For your convenience,
the scenario is repeated in each question. Each question presents a different goal and answer choices,
but the text of the scenario is exactly the same in each question on this series.
You have a database that tracks orders and deliveries for customers in North America. System versioning is
enabled for all tables. The database contains the Sales.Customers, Application.Cities, and
Sales.CustomerCategories tables.
Details for the Sales.Customers table are shown in the following table:

Details for the Application.Cities table are shown in the following table:

Details for the Sales.CustomerCategories table are shown in the following table:

You discover an application bug that impacts customer data for records created on or after January 1, 2014. In
order to fix the data impacted by the bug, application programmers require a report that contains customer data
as it existed on December 31, 2013.
You need to provide the query for the report.
Which Transact-SQL statement should you use?

A.

B.

C.

D.

Explanation:
The datetime datetype defines a date that is combined with a time of day with fractional seconds that is based
on a 24-hour clock.
The DATEFROMPARTS function returns a date value for the specified year, month, and day.
Incorrect Answers:
A: ValidFrom should be less (<) than @sdate AND ValidTo should be greater (>) than @edate.
B: We should add a day with DATEADD, not subtract one day.C: We cannot compare a date to an exact datetime.
https://msdn.microsoft.com/en-us/library/ms187819.aspx