当前位置:Gxlcms > 数据库问题 > 在SQL存储过程中给条件变量加上单引号

在SQL存储过程中给条件变量加上单引号

时间:2021-07-01 10:21:17 帮助过:3人阅读

@where= (DATEDIFF(day,‘‘‘+CONVERT(varchar(100), @d_start, 23)+‘‘‘,sdate)>=0 and DATEDIFF(day,‘‘‘+CONVERT(varchar(100), @d_end, 23)+‘‘‘,sdate)<=0) and + shopid=‘‘‘+@shopid+‘‘‘ and VenderID in + (select vender from tableB where vendertype=‘‘类型‘‘ and shopid=‘‘‘+@shopid+‘‘‘) -- 何问起 hovertree.com

@d_start   @d_end,

@shopid  

 

这三个都是调用存储过程传进来的参数,要将这些与varchar类型的拼接在一起就要用每边3个单引号+变量, eg: where shopid=‘‘‘+@shopid+‘‘‘ 这样写才可以。

 

推荐:http://www.cnblogs.com/roucheng/p/3541165.html

在SQL存储过程中给条件变量加上单引号

标签:

人气教程排行