当前位置: 代码迷 >> Sql Server >> 存储过程 in的有关问题
  详细解决方案

存储过程 in的有关问题

热度:60   发布时间:2016-04-27 20:42:22.0
存储过程 in的问题?
create   procedure   Test
(
@user   varchar
@icUrl   varchar
)as

exec( 'select   *   from   A表   where   user= ' '[email protected]+ ' '   and   Icon_Url   in( ' '[email protected]+ ' ') ')
其中传递的参数值如下:
@user= 'aabb '
@icUrl= ' ' 'include/1.jpg ' ', ' 'include/2.jpg ' ' '
就是得不到需要的结果啊
exec   中的   后面那个参数的写法该如何写,谢谢

------解决方案--------------------
exec( 'select * from A表 where user= ' '[email protected]+ ' ' and Icon_Url in( '[email protected]+ ') ')
------解决方案--------------------
exec( 'select * from A表 where user= ' ' '[email protected]+ ' ' ' and Icon_Url in( ' ' '[email protected]+ ' ' ') ')
------解决方案--------------------
declare @user VARCHAR(1000), @icUrl VARCHAR(1000)
set @user= 'aabb '
set @icUrl= ' ' 'include/1.jpg ' ', ' 'include/2.jpg ' ' '
print 'select * from A表 where user= ' ' '[email protected]+ ' ' ' and Icon_Url in( '[email protected]+ ') '
exec( 'select * from A表 where user= ' ' '[email protected]+ ' ' ' and Icon_Url in( '[email protected]+ ') ')

------------------------------------------
select * from A表 where user= 'aabb ' and Icon_Url in( 'include/1.jpg ', 'include/2.jpg ')
  相关解决方案