>Hi Andrea,
>
>>Uhmm, things are getting darker. What does 'surrogate keys' mean for you ?
>My definition would be Artificially generated primary keys values which the user doesn't see.
Then I'm not using them. I use the generated ID to identify the item represented by the record.
>I guess I went a little too fast here. The NewId() function would do exactly what you said. Moreover, the problem would come when the user adds a record and then Discards/Cancels it rather than saving it. When you add a record, the NewId() function would update the id in the ID table. When you discard/cancel the record the id is the incremented one so you lose one id in between.
Not in my case. I call the NewId() function only when the user ask to save the record, just before the TableUpdate()-related code. So I already know that the user has choosen to save the record. The only risk to lose the Id is when the TableUpdate() fails. But I could keep the lock on the Lookup table just until I've got the return value from TableUpdate()...
Sincerely,
Andrea Brajuka