Multiple choice technology databases

Which part of the following function definition will generate an error?CREATE FUNCTION dbo.Tomorrow ()RETURNS DATETIMEASBEGIN DECLARE @TodaysDate DATETIME SET @TodaysDate = GETDATE() SET @TodaysDate = DATEADD(DD, DATEDIFF(DD, 0, @TodaysDate), 0) RETURN DATEADD(DD, 1, @TodaysDate)ENDGO

  1. SET @TodaysDate = GETDATE()

  2. SET @TodaysDate = DATEADD(DD, DATEDIFF(DD, 0, @TodaysDate), 0)

  3. RETURN DATEADD(DD, 1, @TodaysDate)

  4. No error is generated. The function will be created.

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

In SQL Server, user-defined functions cannot call non-deterministic functions like GETDATE(). GETDATE() returns different values each time it's called, making it non-deterministic, which violates UDF restrictions. The rest of the function (stripping time, adding days) is syntactically correct, but the GETDATE() call makes it invalid.