Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8609527
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T03:54:05+00:00 2026-06-12T03:54:05+00:00

I have a stored procedure in SQL Server 2008 that needs to delete a

  • 0

I have a stored procedure in SQL Server 2008 that needs to delete a few rows of data. But when I run it, it returns a fail and a value of -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

I can’t seem to find what’s wrong.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T03:54:06+00:00Added an answer on June 12, 2026 at 3:54 am

    You’re able to check out the messages yourself, add this to your CATCH block:

    SELECT
    ERROR_NUMBER() AS ErrorNumber
            ,ERROR_SEVERITY() AS ErrorSeverity
            ,ERROR_STATE() AS ErrorState
            ,ERROR_PROCEDURE() AS ErrorProcedure
            ,ERROR_LINE() AS ErrorLine
            ,ERROR_MESSAGE() AS ErrorMessage;
    

    You may want to change that SELECT to PRINT, and then you’ll be able to see the results in the ‘Messages’ tab when running the SP within SSMS.

    I suspect it’s a problem with a Foreign Key or a possible trigger.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a SQL Server 2008 R2 stored procedure that runs a few INSERTs
Let's say I have a stored procedure in Microsoft SQL Server 2005 that returns
I have a stored procedure in SQL Server 2008 that consists of multple select
I have a stored procedure in SQL Server 2008 that I want to store
I have a stored procedure that retrieves sensitive information from an SQL Server 2008
I have a stored procedure on SQL Server 2008 that copies certain values from
I am currently using MS SQL Server 2008. I have a stored procedure that
We have a SQL Server 2008 database that has stored procedures to handle reads/writes/etc.
On my SQL Server 2008 I have a stored procedure with a large number
If i have a stored procedure or a trigger in Sql Server 2008, can

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.