日期:2014-05-18 浏览次数:20564 次
CREATE procedure [dbo].[BBB] @spid varchar(8000) as select * from BI_SPZL where spid in(@spid)
CREATE PROCEDURE [dbo].[BBB] @spid VARCHAR(8000) AS DECLARE @sql VARCHAR(8000) SET @sql = 'select * from BI_SPZL where spid in(' + @spid + ')' EXEC ( @sql )
------解决方案--------------------
你这样传递参数,相当于让字符串SP000000193与字符串'SP000000193'或字符串'SP000000202'去比,
两者当然不相等
改成下面这样
CREATE procedure [dbo].[BBB] @spid varchar(8000) as exec('select * from BI_SPZL where spid in('+@spid+')')