当前位置: 代码迷 >> Sql Server >> 关于存储过程中sql字符串连接的有关问题,多谢大家
  详细解决方案

关于存储过程中sql字符串连接的有关问题,多谢大家

热度:39   发布时间:2016-04-27 20:08:31.0
关于存储过程中sql字符串连接的问题,谢谢大家
大家请帮我看看。
我向存储过程传了一个值,[email protected]
然后调用exec( 'insert   into   #t   select   cfsj_jdsh,cfsj_wzr   from   cfsj   where '[email protected])连将符合条件的记录查询添加到临时表中。
[email protected]_wzr= '123 '   and   cfsj_wzsj> '2007-07-02 '   and   cfsj_wzsj < '2007-07-30 ',但是查出来却没有记录(实际是有的)
请各位高手帮帮忙,急啊~~~


------解决方案--------------------
exec( 'insert into #t select cfsj_jdsh,cfsj_wzr from cfsj where ' '[email protected]+ ' ' ')
------解决方案--------------------
set quoted_identifier off
declare @s varchar(100)
set @s= "insert into #t select cfsj_jdsh,cfsj_wzr from cfsj where "[email protected]
exec(@s)
  相关解决方案