所以我有一个Sybase存储的proc,它接受一个参数,该参数是一个逗号分隔的字符串列表,并在IN()子句中使用in运行查询:
CREATE PROCEDURE getSomething @keyList varchar(4096)
AS
SELECT * FROM mytbl WHERE name IN (@keyList)
如何在列表中调用超过1个值的已存储proc?到目前为止我已经试过了
exec getSomething 'John' -- works but only 1 value
exec getSomething 'John','Tom' -- doesn't work - expects two variables
exec getSomething "'John','Tom'" -- doesn't work - doesn't find anything
exec getSomething '"John","Tom"' -- doesn't work - doesn't find anything
exec getSomething '\'John\',\'Tom\'' -- doesn't work - syntax error
EDIT:我找到了这个page,它很好地参考了将数组传递到存储过程的各种方法
https://stackoverflow.com/questions/6369
复制相似问题