TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Schleid Alex
NA
361
48.2k
Adding transaction to stored procedures
May 24 2021 4:22 PM
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
--BEGIN TRANSACTION
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
--COMMIT TRANSACTION
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!
Reply
Answers (
3
)
Error: the table already has one timestamp column
How do i connect to acess db in .net core