我有一个这样的存储过程:
ALTER PROCEDURE [dbo].[IBS_fetchrequested]
@tid integer =null,
@tbarcode as nvarchar(500)
--@Tbaroced dbo.TBarcode readonly
as
begin
SET NOCOUNT ON;
if (select COUNT(*) from Khanger_tbl where tid=@tid and requested=1 and delivered=0)>0
begin
select t.TBarcode,k.HBarcode as keyloc from Khanger_tbl k
inner join transaction_tbl t on k.transactid=t.transactID
where tid=@tid and requested=1 and delivered=0 and t.Tbarcode not in(@tbarcode) and t.status=3
end
end
我传递的tbarcode值如下:' 450'' 451',' 452' 然后我手动执行了这个存储过程
USE [Vallett]
GO
DECLARE @return_value int
EXEC @return_value = [dbo].[IBS_fetchrequested]
@tid = 20,
@tbarcode = N'''450'',''451'',''452'''
SELECT 'Return Value' = @return_value
GO
但结果仍然得到tbarcode ...我的存储过程出了什么问题? 结果
TBarcode keyloc
-------------------- --------------
450 50
451 51
452 52
我希望结果不包含此TBarcode