我有这样一个存储过程:获得在SQL Server多个返回值
ALTER procedure [dbo].[MobileDevice]
@platesourcecnt integer,
@plateCategory integer
as
begin
declare @SplateSourcecount integer,
@SplateCategory integer,
@Splatecode integer
select @SplateSourcecount= count(ps.PSID)from PlateSource_tbl ps
if @SplateSourcecount <> @platesourcecnt
begin
select PSID,PS from PlateSource_tbl where Deleted=0
end
else
begin
return 1
end
Select @SplateCategory=COUNT(pcat.PCID) from PlateCategory_tbl pcat
if @SplateCategory <> @plateCategory
begin
select PCID,PC,PSID from PlateCategory_tbl where Deleted=0
end
else
begin
return 2
end
末
这里我platesource_tbl
count
是13
,如果我通过价值@platesourcecnt =13
然后我得到返回值1
但那次我的第二个选择查询不起作用。
如果我将除13
之外的其他参数传递给@platesourcecnt
,那么两者都可以工作。
我的存储过程有什么问题?
我可以在一个存储过程中获得多个返回值吗?
为什么要返回,U需要它? – Azar
我想查询一下wethar先查询返回值还是不行? – user3252014
然后使用我给出的变量解决方案 – Azar