If I'd were in your shoes I'd do the following
- Junk the autoinc integers, just make them integer.
- Create a newkey stored procedure that will create a new key and store the latest value in a dedicated key table .
- Set the default value for the PK as Newkey('
') (fill in the name of the field)
- Also use the newkey function in your view definitions.
- You can call the newkey function everywhere in your app.
Still a bit of coding to do I guess, but better than switching to GUID's
Walter,
>>Hi Mike,
>>
>>>GUIDs are bigger than integers and are not the fastest choice.
>>
>>That's what we mostly use, too. Aside from making it easier on the middle-tier or client side to deal with new keys, GUIDs also have the advantage of supporting replication and disconnected scenarios. They are also more scalable because you don't need obtain a lock on a resource that increments a key, whether the resource is a SEQUENCE, an AutoInc field, a stored procedure, or whatever.
>
>I think in the next application I will rather use GUID as well. But is there a solution for my current problem?
>
>Thanks in advance.