大家好,我的问题是:
前台传一个日期,在后台用存储过程接受 ([email protected])
然后执行 select * from A where date between [email protected] + ' 00:00:00'+and [email protected] +' 23:59:59'
编译不能通过,请各位指点一下。多谢!
------解决方案--------------------
- SQL code
select * from A where date between [email protected] + ' 00:00:00' and @ymd +' 23:59:59'
------解决方案--------------------
- SQL code
select * from A where Dates between @ymd+' 00:00:00' and @ymd +' 23:59:59'orcreate proc p_test@ymd varchar(12)asdeclare @sql varchar(max),@sql2 varchar(max)set @sql='select * from A where date between [email protected] + ' 00:00:00'''+'and ''' [email protected] +' 23:59:59'''print @sql---select * from A where date between '2012-04-18 00:00:00'and '2012-04-18 23:59:59'