May 22, 2008 at 12:33 am
/*
Sanjay S -- Jaipur, India
Is this a bug in SQL date Comparision or is there any logical reason
if there is a difference of .001 milisecond then datetime variable comparison behaves strange
*/
Declare @dt1 datetime, @dt2 datetime
set @dt1 = '2008-05-22 11:20:56.079'
set @dt2 = '2008-05-22 11:20:56.080'
if @dt2 <= @dt1
print '1>>> True date comparision1'
set @dt1 = '2008-05-22 11:20:56.078'
set @dt2 = '2008-05-22 11:20:56.079'
if @dt2 <= @dt1
print '2>>> True date comparision2'
if '2008-05-22 11:20:56.080' <= '2008-05-22 11:20:56.079'
print '3>>> True Str comparision1'
if '2008-05-22 11:20:56.079' <= '2008-05-22 11:20:56.078'
print '4>>> True Str comparision2'
/***********************************************
--And here goes the Result
***********************************************
1>>> True date comparision
***********************************************
--Can any body explain this strange result ??
***********************************************/
Viewing 0 posts
You must be logged in to reply to this topic. Login to reply