Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Seeking a brilliant idea to replace NextID() function
Message
De
21/01/2008 12:32:25
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:
01283722
Vues:
18
>>OK Naomi,
>>But I nowehere said Autoinc or Identity:) Simple updatable int field. Use mine if supplied or assign automatically if not. ie:
>>
>>
>>lnID = NextID('MyTable', 1) && allocate 1 key for me
>>* ...
>>insert into myTable (myPK) values (m.lnID)
>>* I may choose to not insert anything and waste the key
>>
>>Or let backend do it:
>>
>>insert into myTable (aFieldOtherThanPk) values ('something')
>>lnID = myTable.PK && it called the NextID via default, ask what has been assigned
>>
>>
>>Wish it was done with GUIDs from the start.
>>
>>Cetin
>>
>
>I see. I guess me and Borislav automatically assumed you were talking about Identity field.
>
>So, what exactly is the problem - get the ID after it was calculated by default or get it using the same function but without an actual insert?

Yes, I want to have it both as a default value when not passed during an insert or get it using the same SP w/o an actual insert (insert may take place later or not, and if later it might already have assigned that value as foreign key to some child tables as well).
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform