用sql语句判断时间段 我想用sql判断我现在的时间 在不在某个时间段 怎么来实现 请各位大侠指点 谢谢! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 access select * from xxx where xxx between #2001-01-01# and #2012-01-01#sqlserverselect * from xxx where xxx between '2001-01-01' and '2012-01-01' datetime类型的可以直接比较,string类型则需要转换后比较 如,判断YourTime在不在 “时间1”和“时间2”之间getdate()>=时间1 and getdate()<=时间2 select * from A where GETDATE() not between '2012-02-01' and '2012-08-03' select * from tablename wheredatediff(d,时间字段,getdate())=0 anddatepart(h,时间字段)>=9 and datepart(h,时间字段)<=12 not between ……and …… 例如我要判断目前时间是不是在9:20分到12:00之间 每天这个时间段为交易时段,这个用sql语句有办法实现没? 例如我的交易时间是每天的9:20分到下午6:00 用sql语句怎么来判断目前的时间是否是在交易时段? strtime>='2012-07-11 9:17:20' and strtime<='2012-07-11 18:17:20'带上时分秒 select dateName(hh,getdate()) +':'+ dateName(Mi,getdate()) +':'+ dateName(Second,getdate()) --获取系统当前时间 如15:12:38比较的话...等待高人出现 SELECT CONVERT(DATETIME,CONVERT(varchar,GETDATE(),101)+' 09:00:000')--2012-07-18 09:00:00.000 ---检测当前时间是否为早上0:00:00.000 到 07:30:00.000 之间DECLARE @Seconds int;DECLARE @CurrentDate DATETIME;DECLARE @LimitDate DATETIME;SELECT @CurrentDate = GETDATE();SELECT @LimitDate = CONVERT(DATETIME, CONVERT(VARCHAR(10), GETDATE(), 21) + ' 07:30:00')SELECT @Seconds = DATEDIFF(second, @CurrentDate, @LimitDate)IF(@Seconds > 0)BEGIN SELECT @CurrentDate = @CurrentDate - 1;ENDSELECT CONVERT(DATETIME, CONVERT(VARCHAR(10), @CurrentDate, 21) + ' 00:00:00'); DataSet里返回单值存储过程问题 网站设计的开始 关于单点登录的问题:用户组,权限等 引用 microsoftajax.js 正确方法 求图片上传代码 控件帮定到Dataset的DataTable中,如何进行分页处理?控件非GridView. 有谁遇到过这种问题吗?(已經開啟一個與這個 Command 相關的 DataReader,必須先將它關閉) 请教:在页面中动态创建控件将赋值时,为什么无法保持其ViewState? 如何使文本框只能输入数字? 谁能帮我?在线等待. 为什么自己创建的WebClient无法下载百度文库的文章 SQL与ORACLE
select * from xxx where xxx between #2001-01-01# and #2012-01-01#sqlserver
select * from xxx where xxx between '2001-01-01' and '2012-01-01'
如,判断YourTime在不在 “时间1”和“时间2”之间getdate()>=时间1 and getdate()<=时间2
datediff(d,时间字段,getdate())=0 and
datepart(h,时间字段)>=9 and datepart(h,时间字段)<=12
strtime>='2012-07-11 9:17:20' and strtime<='2012-07-11 18:17:20'带上时分秒
--2012-07-18 09:00:00.000
DECLARE @CurrentDate DATETIME;
DECLARE @LimitDate DATETIME;
SELECT @CurrentDate = GETDATE();
SELECT @LimitDate = CONVERT(DATETIME,
CONVERT(VARCHAR(10), GETDATE(), 21) + ' 07:30:00')
SELECT @Seconds = DATEDIFF(second, @CurrentDate, @LimitDate)
IF(@Seconds > 0)
BEGIN
SELECT @CurrentDate = @CurrentDate - 1;
ENDSELECT CONVERT(DATETIME, CONVERT(VARCHAR(10),
@CurrentDate, 21) + ' 00:00:00');