菜鸟求助 select * from rls where datepart(hh,begintime)=19 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 select * from rls where datepart(hh,begintime ) = 19 如果附加日期条件,则:select * from rls where datepart(hh,begintime)=19 and begintime between '开始日期' and '结束日期' 你的begintime是字符串型的数据?select * from rls where substirng(begintime , 11,2) = '19' substirng(begintime , 11,2)中的11,2是怎么来的? declare @t table(begintime varchar(20),bss int, bts int )insert @t select '2009-03-25 17:00', 0 , 1 insert @t select '2009-03-25 18:00', 0 , 2 insert @t select '2009-03-25 19:00', 0 , 3 insert @t select '2009-03-25 17:00', 0 , 1 insert @t select '2009-03-25 18:00', 0 , 2 insert @t select '2009-03-25 19:00', 0 , 3select * from @t where datepart(hh,begintime)=19 begintime bss bts-------------------- ----------- -----------2009-03-25 19:00 0 32009-03-25 19:00 0 3(2 行受影响)测了一下,如果是字符串,也会转换过来,可不用加引号。 把SQL2008远程数据库备份到本机? ?sql语句? 初学者一个查询,很简单,但总搞不明白.谢谢大家 随机行+指定行,在sql里应该怎么写,在线等,加急!!! 看下这个procedure 怎么有所改进的? C# 数据库备份问题?? 紧急求助:SQL SERVER 数据库附加的问题。 ???从事数据库维需哪些知识??? 一道考试题 大哥们给我看看下面个那里错了! 取两列中最大值 存储过程调用问题
select * from rls where datepart(hh,begintime)=19 and begintime between '开始日期' and '结束日期'
insert @t select '2009-03-25 17:00', 0 , 1
insert @t select '2009-03-25 18:00', 0 , 2
insert @t select '2009-03-25 19:00', 0 , 3
insert @t select '2009-03-25 17:00', 0 , 1
insert @t select '2009-03-25 18:00', 0 , 2
insert @t select '2009-03-25 19:00', 0 , 3
select * from @t where datepart(hh,begintime)=19 begintime bss bts
-------------------- ----------- -----------
2009-03-25 19:00 0 3
2009-03-25 19:00 0 3(2 行受影响)测了一下,如果是字符串,也会转换过来,可不用加引号。