Which Transact-SQL query should you use?

Your database contains a table named Purchases. The table includes a DATETIME column named
PurchaseTime that stores the date and time each purchase is made. There is a non- clustered index on the
PurchaseTime column. The business team wants a report that displays the total number of purchases made on
the current day. You need to write a query that will return the correct results in the most efficient manner.
Which Transact-SQL query should you use?

Your database contains a table named Purchases. The table includes a DATETIME column named
PurchaseTime that stores the date and time each purchase is made. There is a non- clustered index on the
PurchaseTime column. The business team wants a report that displays the total number of purchases made on
the current day. You need to write a query that will return the correct results in the most efficient manner.
Which Transact-SQL query should you use?

A.
SELECT COUNT(*)
FROM Purchases
WHERE PurchaseTime = CONVERT(DATE, GETDATE())

B.
SELECT COUNT(*)
FROM Purchases
WHERE PurchaseTime = GETDATE()

C.
SELECT COUNT(*)
FROM Purchases
WHERE CONVERT(VARCHAR, PurchaseTime, 112) =
CONVERT(VARCHAR, GETDATE(), 112)

D.
SELECT COUNT(*)
FROM Purchases
WHERE PurchaseTime >= CONVERT(DATE, GETDATE())
AND PurchaseTime <DATEADD(DAY, 1, CONVERT(DATE, GETDATE()))

Explanation:
To compare a time with date we must use >= and > operators, and not the = operator.
Incorrect Answers:
A: The in WHERE clause there is an incorrect comparison between time and a date, as equality (=) is used.

http://technet.microsoft.com/en-us/library/ms181034.aspx



Leave a Reply 11

Your email address will not be published. Required fields are marked *


Noel

Noel

Anyone knows is this valid?

ZVV

ZVV

Most of these questions are just questions from old exams, like 70-462 or 70-464.
Only questions after #70 are relevant to real 70-765 exam.

ZVV

ZVV

Passed it recently – had only ~25% of questions from this list…

Sheree

Sheree

Please contact me and we can share some real exam questions knowledge related to exams questions.
shereeroberts at protonmail dot com

Runing Man

Runing Man

New 70-765 Exam Questions and Answers (Updated at 7th/12/2017)

QUESTION
You administer two Microsoft SQL Server 2012 servers. Each server resides in a different, untrusted domain.
You plan to configure database mirroring.
You need to be able to create database mirroring endpoints on both servers.
What should you do?

A. Configure the SQL Server service account to use Network Service.
B. Use a server certificate.
C. Use a database certificate.
D. Configure the SQL Server service account to use Local System.

Answer: B

QUESTION
You administer a Microsoft SQL Server 2012 instance that has several SQL Server Agent jobs configured.
When SQL Server Agent jobs fail, the error messages returned by the job steps do not provide the required detail.
The following error message is an example error message:
“The job failed. The Job was invoked by User CONTOSO\ServiceAccount. The last step to run was step 1 (Subplan_1).”
You need to ensure that all available details of the job step failures for SQL Server Agent jobs are retained.
What should you do?

A. Configure output files.
B. Expand agent logging to include information from all events.
C. Disable the Limit size of job history log feature.
D. Configure event forwarding.

Answer: B

QUESTION
You administer a Microsoft SQL Server 2012 instance.
You need to configure a new database to support FILETABLES.
What should you do? Choose all that apply.

A. Disable FILESTREAM on the Database.
B. Enable FILESTREAM on the Server Instance.
C. Configure the Database for Partial Containment.
D. Create a non-empty FILESTREAM file group.
E. Enable Contained Databases on the Server Instance.
F. Set the FILESTREAM directory name on the Database.

Answer: BDF

QUESTION
You administer two instances of Microsoft SQL Server 2012.
You deploy an application that uses a database on the named instance.
The application is unable to connect to the database on the named instance.
You need to ensure that the application can connect to the named instance.
What should you do?

A. Configure the application as data-tiered.
B. Open port 1433 on the Windows firewall on the server.
C. Configure the named SQL Server instance to use an account that is a member of the Domain Admins group.
D. Start the SQL Server Browser Service.

Answer: D

More NEW 70-765 Exam Questions: https://www.braindump2go.com/70-765.html

Kav saminau

Kav saminau

Today i have passed using [email protected] dumps.

He having valid dumps (He charges more money , but still valid dumps)

Saad

Saad

Hi,
I’m planning to do the exam next week. Can you send me the questions and answers to [email protected]

Thanks,