Which of the following statement is correct for DATEDIFF function in SQL? I.…

2024

Which of the following statement is correct for DATEDIFF function in SQL? I. This function reports difference between the arguments ‘startdate’ and ‘enddate’. II. In this, ‘datepart’ argument/value can be specified in a variable.

Answer: A. Only IThe SQL `DATEDIFF` function returns the difference between `startdate` and `enddate` for a specified date part. In SQL Server, the `datepart` argument is a…

  1. A.

    Only I

  2. B.

    Neither I nor II

  3. C.

    Both I and II

  4. D.

    Only II

Attempted by 567 students.

Show answer & explanation

Correct answer: A

The SQL `DATEDIFF` function returns the difference between `startdate` and `enddate` for a specified date part. In SQL Server, the `datepart` argument is a keyword, not a variable value. Therefore only statement I is correct.

Explore the full course: Up Lt Grade Assistant Teacher 2025

Loading lesson…