日期:2014-05-18  浏览次数:20325 次

急,往存储过程里传带,号的参数 存储过程 in(参数)不出来
往存储过程里传带,号的参数   存储过程   in(参数)不出来

一个存储过程参数   如(1,2,3,4,5,6)
传给存储过程
存储过程里面

该参数我在存储过程里设置了   varchar(255)类型
select   *   from   b   where   btype   in(传进的参数)
查不出来

------解决方案--------------------
一个存储过程参数 如(1,2,3,4,5,6)
传给存储过程
存储过程里面

该参数我在存储过程里设置了 varchar(255)类型
select * from b where btype in(传进的参数)
查不出来
--------------
select * from b where charindex( ', '+btype+ ', ', ', '+@str+ ', ')> 0
------解决方案--------------------

exec ( 'select * from b where btype in( ' + 传进的参数 + ') '
------解决方案--------------------
--用charindex或动态SQL

exec ( 'select * from b where btype in( ' + 传进的参数 + ') '

------解决方案--------------------
一个存储过程参数 如(1,2,3,4,5,6)

---------------------

樓主,這個是偉一個字符串吧
------解决方案--------------------
用wangtiecheng老大的,你偉的參數必須是一個一個偉的,我想用在你這是不行的
------解决方案--------------------
declare @sql varchar(1000)
select @sql= 'select * from #table where id in ( '+ @参数 + ') '
execute @sql

------解决方案--------------------
如果你不用动态 而直接
select * from #table where id in (@参数)
的话
程式会把 @参数 看做一个整体... 而不会自己按逗号拆开.
------解决方案--------------------
如果是前台调用就简单多了