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 ')