Do the product ids have meaning outside the database? If so it is
probably better to use another field as the primary identifier that
does not have meaning outside the database and so can be an integer.
However, whether you do that or not I think that the best way to
generate the next number is to use a transaction in the insert stored
procedure and first SELECT @NewId = MAX(PID) + 1 FROM Product; and then insert @NewId into the PID for the new row.
I hope this helps.
|