Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Seeking a brilliant idea to replace NextID() function
Message
From
21/01/2008 12:32:25
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Database:
MS SQL Server
Miscellaneous
Thread ID:
01283680
Message ID:
01283722
Views:
17
>>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
Previous
Reply
Map
View

Click here to load this message in the networking platform