select * from 表1 where abc(datediff(minute,dDate,'1999-8-2 16:59:02'))<=1

解决方案 »

  1.   

    select * from 表1 where abc(datediff(minute,dDate,'1999-8-2 16:59:02'))<1
      

  2.   

    select * from 表1 where dDate='1999-8-2 16:59:02'无法查到是因为字段中实际上也保存的毫秒的信息,但是你的条件中没有毫秒,所以找不到。select * from 表1 where dDate='1999-8-2 16:59:02.XXX' XXX为毫秒数,这样就可以找出你要的记录,如果你不需要精确到毫秒,那么可以:
    select * from 表1 where convert(char(19),dDate,120)='1999-08-02 16:59:02'
      

  3.   

    select * from 表1 where cast(dDate as smalldatetime) ='1999-8-2 16:59:02'
    --还有个微秒,你没注意
      

  4.   

    select * from 表1 where convert(char(19),dDate,20)='1999-08-02 16:59:02'
      

  5.   

    where convert(char(19),ddate,120)='1999-8-2 16:59:02'
      

  6.   

    错了,对不起,是ABS
    select * from 表1 where abs(datediff(minute,dDate,'1999-8-2 16:59:02'))<1
      

  7.   

    select * from 表1 where cast(dDate as smalldatetime) ='1999-8-2 16:59:02'
      

  8.   

    abc是绝对值,大家的方法都还不错。
    应该是毫秒,我给写成微秒了。