ALTER PROCEDURE [dbo].[K_HM_InsertSetterGetterAllocationDet]
@type varchar(50),
@name varchar(50),
@settingdate datetime,
@quantity int,
@Batchno varchar(50),
@pulloutdate datetime,
@supervisor varchar(50),
@updatedby varchar(50)
AS
BEGIN
SET NOCOUNT ON;
if exists(select * from K_HM_SetterGetterAllocationDet where Name=@name and [type]=@type and Attrited='false')
begin
select '1' as status
end
else
if exists (select * from K_HM_GetterSetterDet where Capacity >=@quantity)
begin
select '2' as status
end
else
insert into K_HM_SetterGetterAllocationDet (Type, Name, Settingdate, Quantity, batchno,pulloutdate,Supervisor,Attrited,Updatedby,Updatedon)
values (@type, @name, @settingdate, @quantity, @Batchno, @pulloutdate, @supervisor, 'false', @updatedby, getdate())
select '3' as status
END
在上述过程中,当上述两种情况为假且数量小于容量时,第三种情况不执行。数量小于或大于容量总是只进入第二种情况。我的程序有什么问题,请帮助我......