Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
AutoInc troubles
Message
From
01/07/2003 03:07:13
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Other
Title:
AutoInc troubles
Miscellaneous
Thread ID:
00805589
Message ID:
00805589
Views:
56
Hello, everyone

I am trying to use this new kind of field. Works fine, unless I use a view to update the table and I need to know the value, to use it in a secondary table, as FK. In SQL Server we have @@Identity, which returns the last integer value inserted, but I have absolutely no idea how to handle this in VFP. According to the help, I need to do a REQUERY to see the new value.

Are they kidding me or do I miss something here? First, the whole thing is in a transaction - can't REQUERY() in transactions. Second, to REQUERY() I need a parameter, which, in this case, is exactly the value I need to know - the Autoinc PK. Deadlock. If I don't use any parameter, I'll get all the records, and even me I'm not stupid enough to do such thing. Another deadlock.

There is another way: SELECT * FROM table WHERE field1 = value1 AND field2 = value2 ... .... ........, where "values" are the brand new inserted values. First - a lot of work just to get an integer. Second, I'm not 100% sure I'll get one single record - there could exist duplicate records, only their PK is different. Another deadlock.

Nah. I'd better stick using the Tastrade way.

What do you do in such cases, guys? I can't believe I'm the first one having this problem....

Thank you
Grigore Dolghin
Class Software.
Next
Reply
Map
View

Click here to load this message in the networking platform