所以我有一个Sybase存储过程,它接受1个参数,这是一个以逗号分隔的字符串列表,并在IN()子句中使用in运行查询:
CREATE PROCEDURE getSomething @keyList varchar(4096)
AS
SELECT * FROM mytbl WHERE name IN (@keyList)
Run Code Online (Sandbox Code Playgroud)
如何在列表中调用超过1个值的存储过程?到目前为止我已经尝试过了
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
Run Code Online (Sandbox Code Playgroud)
编辑:我实际上发现这个页面有很好的参考,可以将数组传递给sproc