Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL Server NewID's
Message
 
To
31/05/2001 19:56:04
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00513516
Message ID:
00513576
Views:
16
I think this depends on your specific needs and/or proferences.

Identity fields are great, although, they require an extra trip to the server to see what was the identity generated.

The meta-table also works fine. Just make sure the meta-table is also in the server so everybody uses the same table. Also, make sure you use transactions to lock the record you are modifying in the meta-table while you are generating the next id.

I wouldn't propose the MAX(ID).

Another approach could be to generate GUID values in the client application. The chances that you get duplicates this way is minimal and you save the extra trip to the server.


>Hi, everybody!
>
>What is best way to retrieve NewID on a SQL Table:
> * Identity Fields?
> * A Meta-Table with the last ID generated for each one of my tables?
> * A SELECT MAX(ID) Statement?
>
> Or there's some other?
>
> I'm developing a N-Tier application and I'm using ADO RecordSets to pass data through layers...
>
> Any information about this issue is of extreme importance for me.
>
> Thanks in Advance!
Hector Correa
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform