Hello All,
Basically I am trying to implement assigning of unique consecutive integers from a particular row in a table in MSSQL 2000.
Example pseudocode:
<code>
SET ISOLATION LEVEL REPEATABLE READ
SELECT @VAR1 = NextAvailableNu mberColumn FROM TheTable WHERE pk=@pk
UPDATE TheTable SET NextAvailableNu mberColumn = @VAR1 + 1 WHERE pk=@pk
RETURN @VAR1
COMMIT
</code>
Will this ensure that each client will always get a unique consecutive number, or is it possible that this could return the same number to more than one client? Also, if this works, could someone please explain why.
Basically I am trying to implement assigning of unique consecutive integers from a particular row in a table in MSSQL 2000.
Example pseudocode:
<code>
SET ISOLATION LEVEL REPEATABLE READ
SELECT @VAR1 = NextAvailableNu mberColumn FROM TheTable WHERE pk=@pk
UPDATE TheTable SET NextAvailableNu mberColumn = @VAR1 + 1 WHERE pk=@pk
RETURN @VAR1
COMMIT
</code>
Will this ensure that each client will always get a unique consecutive number, or is it possible that this could return the same number to more than one client? Also, if this works, could someone please explain why.
Comment