>>Well, this stuff depends on the approach you apply when you save a new record. My preference is to generate NewId after all validations made, i.e. the only chance that INSERT will fail is network hardware problem, i.e. normally it will go Ok 99%, and some 'holes' is not a problem as long as database uses surrogate primary/foreign keys.
>
>Right, I'd call NewId just after my validation, but I don't share your confidence over network hardware problems. Add some kernel32 problems with Word97, some problems with W95 and I could talk about 70%....
>And for this particular app I *must* avoid 'holes' because I won't use surrogate primary keys (for compatibility reasons).
>
>>PS. When you 'RETURN nNewid', it means that you get it back to your code.
>
>Hey ! I know it ! :)
>But if I'm going to use it on a stored procedure that executes as the Default field value for the table, I won't be able to get the value back, because I'm not calling it from my code...
If you type procedure name as default field value in table designer (personally, i wouldn't use for primary key generation) then the procedure return value will be used as default value, right?
Edward Pikman
Independent Consultant