Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Sql add ID number - simultaneously

Posted on 2015-01-13
3
Medium Priority
?
152 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 71

Accepted Solution

by:
Qlemo earned 1000 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 46

Assisted Solution

by:Kent Olsen
Kent Olsen earned 1000 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 71

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
Microsoft Access has a limit of 255 columns in a single table; SQL Server allows tables with over 255 columns, but reading that data is not necessarily simple.  The final solution for this task involved creating a custom text parser and then reading…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties

885 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