Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
samratmail
Starting Member
1 Post |
Posted - 2008-08-09 : 07:12:09
|
| Hello FriendI have faced a problem in SQL ServerI have a stored procedure which works as followsDeclare @Id intSelect @id=max(id) from empSet @id=@id+1update emp Set id=@idreturn @idNow, we call this stored procedure from our ASP.net application. It is working perfecly in single user environment, but the problem is that when we are working in multi-user environment some time the procedure returns same id instead of unique id.How can I solve it, so that every time the procedure returns unique value for each user. Is there any technique to execute this stored procedure in queue.Thanks in advance |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-08-09 : 07:22:40
|
| the best way to deal with this is to set the id column as of identity type so that sql server will automatically generate values for it during insertion itself. |
 |
|
|
|
|
|