Harshal Thakre

Harshal Thakre

  • NA
  • 227
  • 75.8k

How to solve same id problem?

Aug 25 2014 3:25 AM

IF at the same time 2 user call this procedure snippet....

           @idnumber bigint,
          @name varchar(50)



declare @id bigint=(select MAX(IdNumber)+1 from PersonalDetail)

insert into taba values(@id,@name)

------------------------------------
Note:Id Number is pk.
---------------------------
plz tell me what will happen....
1.Either first user record insert or second.
2.Both will show error.
3.this is not good way to handle such type of problem.
4.No Need to worry both record will insert with diffrent id.
5.Anything else.
------------------
Plz tell me how to solve...
------------


Answers (2)