I am facing the following problem at different points in my code. The SqlException is returned from the database (SQL Server) with the message "Uncommitable Transaction detected at the end of the packet", after which the transaction is completed after the stored procedure is called. The structure of the stored procedure follows this example:
USE [EXAMPLE_DB]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[sp_ExampleStoredProcedure]
@Parameter INT, @AnotherParameter INT
AS
BEGIN
BEGIN TRY
SET NOCOUNT ON;
DECLARE @Variable INT;
DECLARE @AnotherVariable CHAR;
DECLARE @ErrMsg VARCHAR;
SET @ErrMsg = '';
EXECUTE [dbo].[sp_SecondStoredProcedure]
@Param = 'Blabla'
,@Param2 = 'BlaBlaBla'
END TRY
BEGIN CATCH
SET @CustomExitCode = 'XXXXX';
SET @ErrMsg = (SELECT ERROR_MESSAGE());
END CATCH;
END
As you can see, there is no transaction processing inside the stored procedure. I process the transactional code side (C #) using the TransactionScope class, invoking various stored procedures inside the transaction scope, including the one above (which is an error).
: SQL Uncommitable Transaction, SQL-, try-catch, , , ?
Uncommittable Transaction, SQL-.
, .
, , .
!
Cheers,