数行のデータを削除する必要がある 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
何が問題なのかわかりません。