当前日期在fromdate和todate的中间时更新表 [英] update table when current date is in middle of fromdate and todate

查看:95
本文介绍了当前日期在fromdate和todate的中间时更新表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好朋友

我想要表,并且要在当前日期为fromdate和todate的中间时更新View1
RoleId MenuId ViewM FromDate FromTime ToDate ToTime
1 1 0 13/06/2012 10:00 16/06/2012 19:00
1 2 0 13/06/2012 10:00 13/06/2012 15:00
1 3 0 13/06/2012 10:00 13/06/2012 15:00
1 4 0 10/06/2012 10:00 30/06/2012 19:00
1 5 0 13/06/2012 10:00 13/06/2012 15:00
1 6 0 14/06/2012 10:00 22/06/2012 15:00
1 21 0 16/06/2012 10:00 17/06/2012 19:00
1 22 0 15/06/2012 10:00 13/06/2012 15:00
1 23 0 13/06/2012 10:00 2012/06/28 15:00
1 45 0 13/06/2012 10:00 13/06/2012 12:00



谢谢

Hello Friends

i want table and i want to update View1 when current date is middle of fromdate and todate
RoleId MenuId ViewM FromDate FromTime ToDate ToTime
1 1 0 13/06/2012 10:00 16/06/2012 19:00
1 2 0 13/06/2012 10:00 13/06/2012 15:00
1 3 0 13/06/2012 10:00 13/06/2012 15:00
1 4 0 10/06/2012 10:00 30/06/2012 19:00
1 5 0 13/06/2012 10:00 13/06/2012 15:00
1 6 0 14/06/2012 10:00 22/06/2012 15:00
1 21 0 16/06/2012 10:00 17/06/2012 19:00
1 22 0 15/06/2012 10:00 13/06/2012 15:00
1 23 0 13/06/2012 10:00 28/06/2012 15:00
1 45 0 13/06/2012 10:00 13/06/2012 12:00



thanks

推荐答案

假设"fromdate和todate的中间"是指fromdate和todate之间,那么下面的语句将在两个日期之间选择一个值范围: br/>
Assuming by "middle of fromdate and todate" you mean between fromdate and todate then the following statement will work to select a range of values between two dates:

SELECT * FROM mydatetable WHERE datefield BETWEEN @fromdate AND @todate



这是使用BETWEEN运算符.

可以在以下位置找到该操作员的MSDN文章:

http://msdn.microsoft.com/en-us/library/ms187922.aspx [ ^ ]



This is making use the BETWEEN operator.

The MSDN article for this operator can be found here:

http://msdn.microsoft.com/en-us/library/ms187922.aspx[^]


这篇关于当前日期在fromdate和todate的中间时更新表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆