I really need your help with transaction in the following stored procedure.
- ALTER PROCEDURE [dbo].[UP_SAVE_EMPLOYEE_DETAILS]
- @StoreID int,
- @StoreBranchID int,
- @DepartmentID int,
- @FirstName nvarchar(30),
- @LastName nvarchar(20),
- @PhoneNumber nchar(15),
- @Email nvarchar(50),
- @Street nvarchar(50),
- @City nvarchar(25),
- @State nchar(15),
- @Country nvarchar(15),
- @IsEmployee bit,
- @IsCustomer bit,
- @IsSupplier bit,
- @IsReseller bit
- AS
- SET XACT_ABORT ON
-
- DECLARE @PDID INT
- DECLARE @ADDID INT
-
-
- EXEC @PDID = UP_INSERT_PERSONAL_DATA
- @FirstName,
- @LastName,
- @PhoneNumber,
- @Email
-
-
- EXEC UP_INSERT_PERSONAL_DATA_RELATIONSHIP
- @PDID,
- @StoreID,
- @StoreBranchID,
- @DepartmentID,
- @IsEmployee,
- @IsCustomer,
- @IsSupplier,
- @IsReseller
-
-
- EXEC @ADDID = UP_INSERT_ADDRESS @PDID,
- 0,
- Street,
- @City,
- @State,
- @Country,
- @PhoneNumber,
- '000-000-0000'
-
- IF (@PDID > 1 AND @ADDID > 1)
- RETURN 1
- ELSE
- RETURN 0
-
when I try the transaction I have the following error.
Transaction count after EXECUTE indicates a mismatching number of BEGIN and COMMIT statements. Previous count = 0, current count = 1.
Thank you!