我与SQL Server 2008 R2的工作,我有一个存储过程,在那里我试图抛出errror掷错误2008 R2
throw 50001, 'Couldnot process,Please verify Transaction ID and EmbossLine', 1
但查询没有得到执行,并抛出错误50001.它在SQL Server 2012上工作正常。我认为版本存在一些问题。有没有其他方法可以在SQL Server 2008 R2中引发错误?
这是我的存储过程:
Alter procedure [dbo].[spGetRedemption]
@pan varchar(19),
@transId bigint
AS
Begin
if EXISTS(select * from POS_Transactions where [email protected])
Begin
select
PT.ID, PT.TransactionDate, M.MerchantName1,
PT.TerminalID, PT.BatchNumber, PT.SequenceNumber, PT.PAN,
C.EmbossName, PT.TotalAmount, PT.CurrencyCode,
TT.TransactionType, PT.InvoiceNumber
from
POS_Transactions PT
inner join
Terminal T on T.TerminalID = PT.TerminalID
inner join
Merchant M on M.MerchantID = T.MerchantID
inner join
Card C on C.EmbossLine = PT.PAN
inner join
TransactionType TT on TT.TransactionTypeID = PT.TransactionTypeID
where
PT.ID = @transId
and PT.PAN = @pan
END
Else
Begin
throw 50001, 'Couldnot process,Please verify Transaction ID and EmbossLine', 1
END
End
发布查询信息? – Haris
@哈里邮政编辑! – Nuke
'Throw'出现在SQL 2012中; '2008年的Raiserror'。https://msdn.microsoft.com/zh-cn/library/ee677615(v=sql.110).aspx – JohnLBevan