>As I recall, I set the Transaction Isolation Levl to Repeatable Read (I didn't care about new rows at this point). I then started a transaction and queried the PK table to find the last PK used. Once the row was read, it was locked so no one else could change it. I then updated the PK table using SET PK = @PK + 1 WHERE PK = @PK and commit the transaction. I then set the isolation level back to what it was.
Here's another way to do it:
This assumes that the column
nextkey contains the next ID to use.
DECLARE @pk INTEGER
UPDATE keytable
SET @pk = nextkey, nextkey = nextkey + 1
WHERE table = something
This version will assumes that
nextkey contains that last ID used. Which means that you have to increment it first. This is not a typo <s>
DECLARE @pk INTEGER
UPDATE keytable
SET @pk = nextkey = nextkey + 1
WHERE table = something
-Mike