当前位置: 代码迷 >> Sql Server >> sql server 语句中的引号有关问题
  详细解决方案

sql server 语句中的引号有关问题

热度:6   发布时间:2016-04-27 13:18:44.0
sql server 语句中的引号问题
大家好,我的问题是:

前台传一个日期,在后台用存储过程接受 ([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'
  相关解决方案