SQLSERVER特定时间段查询

select * from meet_now where meetdate between CONVERT(datetime , '2008-07-24', 111 ) and convert(datetime , '2008-07-25', 111 ) and order by id 能通过SQL查询分析器,怎么能修改成只查询表中某一天的数据?'2008-07-24处修改成参数类型的?

meetdate是从页面自动获取的时间.
查询条件是根据meetdate字段中的时间,得到表meet_now的内容,每2天从表meet_now取数据.
修改成这样老有语法错误,怎么修改才能通过编译?
SELECT count(*) FROM (SELECT * FROM meet_now WHERE meetdate = convert(datetime,'yyyy-mm-dd'+ 1) -
convert(datetime,'yyyy-mm-dd'))

DECLARE @dt DATETIME
DECLARE @dt2 DATETIME
SET @dt = '2008-07-24'
SET @dt2 = DATEADD(day, 1, @dt)

select @dt as dt, @dt2 as dt2

select * from meet_now where meetdate between CONVERT(datetime , @dt, 111 ) and convert(datetime , @dt2, 111 ) order by id

select * from meet_now where DATEDIFF(day, meetdate, @dt) = 0 order by id
温馨提示:内容为网友见解,仅供参考
第1个回答  2008-07-25
select * from meet_now where convert(varchar(10),meetdate,20)='2008-07-24' order by id
相似回答