Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Having identity crisis!
Message
From
30/09/1999 11:24:01
 
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00270941
Message ID:
00271102
Views:
25
Ian, Cetin, John, et al:

Thanks to all of you for your help. I am still having trouble understanding why, if I have a remote view which includes the identity column of the table, when I issue a REQUERY() the idenity column value isn't directly readable from the view cursor.

INSERT INTO tcParent (somecolumns) VALUES (somedatavalues)
TABLEUPDATE(1,.T.,'tcParent')
REQUERY('tcParent')

Anytime after the tableupdate() I can suspend, browse the remote view cursor, and see the value I need. But when I do a calculate() Select max() statement it holds a value for many iterations of the loop, increments it and holds it again for some time, and so on....

Given the spec I have, this identity column is the only sure relational identifier I have available.

Thanks!
Tom.

>>Hi Tom ----
>>
>>Ian proposed @@IDENTITY, which is the optimal way of getting the latest ID, but that doesn't always work. Another way would be two open two connections to the table. Save on the first connection, then requery the table with the second connection and get the key that way.
>>
>
>John,
>
>How would you know which was the record ou had just added on the second connection? Would you need another key made up from the other fields?
>
>In what circumstances does @@IDENTITY not work? - I ask as its been ages now since I was lucky enough to do anything with SQL Server!
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform