Jeff Moden (2/18/2013)
Kingston Dhasian (2/18/2013)
Jeff Moden (2/15/2013)
I suppose consistency is a good reason. But, let's try something just for fun. Write some code to add 41:41:41.041 to a given date.My version
DECLARE@date DATETIME
SET@date = CURRENT_TIMESTAMP
SELECT @date AS Date, DATEADD(MILLISECOND, 41, DATEADD(SECOND, 41, DATEADD(MINUTE, 41, DATEADD(HOUR, 41, @date)))) AS Date_Added
I get the output as below
Date Date_Added
2013-02-18 10:29:50.343 2013-02-20 04:11:31.383
The only strange thing I observed is that it always 40 milliseconds instead of 41 milliseconds.
Is there any other strange thing?
I'll try to get back to this after worrk tonight. In the mean time, remember that DATETIME has an accuracty of only 3.3 milliseconds. All DATETIMES will end with 0, 3, or 7 for the final digit in the milliseconds.
My apologies, Kingston. My requirements weren't clear. The 41:41:41.041 was supposed to be a VARCHAR.
--Jeff Moden
Change is inevitable... Change for the better is not.