Posted by Randy Martin on 02/14/06 17:24
Maybe this
select top 1 ID, PIN from pin_table where acquired_by = <not acquired
value> (NOTE: this could be expensive if you use null to signify Not
Acquired, perhaps a non-null value with an index would help).
update pin_table set acquired_by = <acquired value> where ID = <ID from
select>
commit
--or --
set up one table containing the unused pins and one containing the used
pins
then
select top 1 ID, PIN from unused_pin
insert into used_pin values (ID, PIN)
delete from unused_pin where ID = ID
commit
[Back to original message]
|