Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Sql add ID number - simultaneously

Posted on 2015-01-13
3
Medium Priority
?
146 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Does Your Cloud Backup Use Blockchain Technology?

Blockchain technology has already revolutionized finance thanks to Bitcoin. Now it's disrupting other areas, including the realm of data protection. Learn how blockchain is now being used to authenticate backup files and keep them safe from hackers.

Question has a verified solution.

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

Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
It is possible to export the data of a SQL Table in SSMS and generate INSERT statements. It's neatly tucked away in the generate scripts option of a database.
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.

730 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