我在 SQL Server 2008 中有一个存储过程,需要删除几行数据。但是当我运行它时,它返回一个失败和一个值-6。
ALTER procedure [dbo].[p_CaseFiles_Exhibits_DeleteExhibits]
@ExhibitID int
, @Message nvarchar(50) output
as
declare @FileID int
set @FileID = (select FileID from CaseFileExhibits where ExhibitID = @ExhibitID)
begin transaction
begin try
delete from CaseFileExhibitMovementTracking where ExhibitID = @ExhibitID
delete from CaseFileExhibitAttachments where CaseFileExhibitID = @ExhibitID
delete from CaseFileExhibits where ExhibitID = @ExhibitID
delete from CaseFileExhibitPropertyLink where ExhibitID = @ExhibitID
update CaseFileQuickStats set ExhibitCount = ExhibitCount -1 where CaseFileID = @FileID
commit transaction
end try
begin catch
set @Message='Fail'
rollback transaction
end catch
我似乎无法找到问题所在。