【发布时间】:2015-07-13 01:58:30
【问题描述】:
我需要一些帮助!
我有一个带有 try/catch 块的存储过程。它工作正常,但是当我尝试通过输入应该命中 catch 块的值进行测试时,它似乎没有这样做。我的 catch 块是否有问题,它没有回滚事务?就像坏数据被放入数据库一样,即使它不应该。我究竟做错了什么??先感谢您!
begin try
Begin Transaction
Insert Into ProcessingRequestQueue(PRQID,PRQTarget, PRQStatus, PRQCommand, PRQCDSRNO)
Values (newid(),'CARDSIEVER','I',@PRQCommand,@cdsrno)
commit
End Try
Begin Catch
IF (@cdsrno = 0 and (@cdsrno is null or @cdsrno = ''))
or (@PRQCommand is null or @PRQCommand = '')
rollback
End Catch
END
【问题讨论】:
标签: sql stored-procedures transactions try-catch