我想删除每天某一时间段的数据,如想删除17:30---08:00的加班数据,请问SQL如何写?偶是菜鸟,望赐教。

解决方案 »

  1.   

    如果有时间字段 ,比如 t_date直接 delete from tabel1 where datepart(hh,t_date)>17 and datepart(hh,t_date)<8
      

  2.   

    哦,改一下,上面那个没有算分钟delete from tabel1 where (datepart(hh,t_date)>17 and datepart(n,t_date)>30)  and datepart(hh,t_date)<8
      

  3.   

    http://topic.csdn.net/u/20080523/17/d2707463-bad5-4554-ba5c-117ba4b9cfc3.html
      

  4.   

    delete from table where datecolumn between '2008-05-03 17:30' and '2008-05-03 08:00'
      

  5.   

    delete from tabel1 where (datepart(hh,ftime)>17 and datepart(n,ftime)>30) or datepart(hh,ftime)<8
      

  6.   

    你们这只是删除某一天的语句,我是想一次性删除一个月的,如五月份所有这个时间段的数据。
    表结构如下: NUMBER                 FTIME                    JH
               01                  2007-5-23 17:30:32         1