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...
------------
How to solve same id problem?
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.


Riyaz AkhtarRank #2,275 · 619 reputationPosted Aug 24, 2014, 11:54 PM EDT
Abhineet SrivastavaRank #1,890 · 783 reputationPosted Aug 24, 2014, 11:33 PM EDT
Like
If Exist(select 1 from table where id=@id)
{
return;
}