Количество транзакций после выполнения указывает на несоответствие числа операторов BEGIN и COMMIT.
Я получаю эту ошибку
Transaction count after EXECUTE indicates a mismatching number of BEGIN and COMMIT statements. Previous count = 1, current count = 0.\r\nTransaction count after EXECUTE indicates a mismatching number of BEGIN and COMMIT statements. Previous count = 1, current count = 0
Что я уже пробовал:
create PROCEDURE [dbo].[sp] @Id1 int ,@BBId int ,@Text nvarchar(100) ='' AS Begin Begin transaction declare @Id int INSERT INTO table1 select @Text where @Text <> '' SET @Id = SCOPE_IDENTITY() INSERT INTO table2 (Id1, @Id) select @Id1,@Id from table3 where table3.BBId = @BBId AND table3.Flag= 0 and table3.Id1 = @Id1 if(@@rowcount>0) begin UPDATE table3 SET Flag= 1 WHERE table3.BBId = @BBID AND table3.Id1 = @Id1 COMMIT TRANSACTION end else rollback transaction END Return 0