SQL Server 2008에서 몇 행의 데이터를 삭제해야하는 저장 프로 시저가 있습니다. 그러나 그것을 실행할 때 실패와 -6의 값을 반환합니다.SQL Server 저장 프로 시저가 '실패'를 반환합니다.
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
내가 잘못 된 것 같습니다. 당신 자신이 당신의 CATCH 블록이 추가 메시지를 확인 할 수있어
죄송합니다. 그것을 바꾼 – user1084319
각각의 쿼리와 함께 저장된 proc을 개별적으로 실행하여 어떤 쿼리가 실패했는지 확인하려 했습니까? 아니면 저장된 프로 시저 밖에서 각각 별도로 실행해도됩니까? – Taryn
이런 종류의 "메타"정보에는 ** 태그 **를 사용해야합니다 - 지금 업데이트했습니다 –