Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Seeking a brilliant idea to replace NextID() function
Message
De
22/01/2008 10:16:27
Metin Emre
Ozcom Bilgisayar Ltd.
Istanbul, Turquie
 
 
À
21/01/2008 11:16:53
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Database:
MS SQL Server
Divers
Thread ID:
01283680
Message ID:
01284022
Vues:
16
Use Oracle. That's easy with Oracle... :)

Oracle Express is free like SQL-Express...

>I have a project that's working against native VFP tables. Now I'm in the process of making this SQL+Native switchable.
>
>Project unfortunately use int keys as primary keys and worse implemented the NextID() similar to the one in solution samples (well may it looked good in those days where it was first build). There are places where you need to know the key before inserting and places where it's simply not specified in insert and gets its default value from NextID().
>
>In SQL server though, you cannot specify a function that inserts/updates data (namely it should isert/update IDS table). IDENTITY wouldn't work either (remember sometimes it needs to get the key before insertion). Replacing PKs with GUIDs would be an easy solution but unfortunately in code there are many places the value is checked as being 0 or not.
>
>The question is how would you implement this? I tried INSTEAD OF trigger, but failed (really might work, just couldn't write the code that would work for multiple inserts yet). My idea so far:
>Use CA and in beforeinsert call NextID SP, update the command sent. However it wouldn't work with batch updates. BeforeCursorUpdate is what I think the place to do this. Not having used CA much I don't have a clear idea if that would work. Has anyone tried or have a better idea?
>TIA
>Cetin
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform