Solved

Sql add ID number - simultaneously

Posted on 2015-01-13
3
129 Views
Last Modified: 2015-01-14
I alreday created Automatic number generate
For example
HR00001

I need to know if one user open form it will need to generate HR00001 and same time another user open the page need to create HR00002. any one have any idea appriciate, may be example?
I thought may be use LOCK but confusing how to do that?
0
Comment
Question by:ukerandi
  • 2
3 Comments
 
LVL 68

Accepted Solution

by:
Qlemo earned 250 total points
ID: 40547869
The only way to get that working with autonumber is by inserting an "empty" row when the form is opened, and read the autonumber in to know which row to update.
If the form is cancelled (if available), the newly created empty row needs to get deleted or invalidated.
0
 
LVL 45

Assisted Solution

by:Kdo
Kdo earned 250 total points
ID: 40547874
The autonumber (IDENTITY) column will manage that for you even if the two inserts appear to be simultaneous.


Good Luck,
Kent
0
 
LVL 68

Expert Comment

by:Qlemo
ID: 40547927
Kdo is correct if you do not need the autonumber in the form, which I assumed. In that case you do not need to care, as he said.
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now