Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
1
Reply
What is the best way to increment a transaction number
Hold On
Sep 20 2017 5:22 AM
174
Reply
I am currently developing a travel insurance system. In my table, I have a transaction number which should increment by 1 every transaction. I tried using the code below in my previous development but primary column ID jumps (e.g. before insert row number is 10 after insert row number becomes 12). The travel insurance that I currently developing will be used entire Laos country. That means I am expecting concurrent users of +/- 200.
ALTER
PROCEDURE
[dbo].[spAutoGenerateMotorCINo]
AS
BEGIN
declare
@ID
int
, @RefNumber nvarchar(15);
Select
@ID =
ISNULL
(
Max
(
Cast
(
RIGHT
(MotorInsuranceID, 15)
as
int
)), 0) + 1
from
tblMotorInsurance_eCI;
Select
RIGHT
(
cast
(@ID
as
nvarchar), 9);
END
Thank you in advance for any suggestions and recommendations.
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
1
)
Next Recommended Forum
How to search db value with 'or' condition sql server
How to Display Multiple column in a DropDownlist