CREATE TABLE #TestDate
[ID] int IDENTITY(1,1)
,[FullDate] datetime DEFAULT (GETDATE()),
INSERT INTO #TestDate VALUES
SELECT COUNT([FullDate]) FROM #TestDate
WHERE CAST([FullDate] as int) = 40358
DROP TABLE #TestDate
Answer this without cheating (without executing the Query). Here are the options:
F. None of the above
Correct Answer is B.
Reason: Dates 07/01/2010 and 2010/07/01 are inserted as 2010-07-01 00:00:00.000 in the database which is equal to 40358 of int type. So when the conversion into int and then taking ceiling of the values, these 2 records generate the same values. However, 01/07/2010 is saved as 2010-01-07 00:00:00.000 in the database which is equal to 40183 of type int.