General information
Category:
Databases,Tables, Views, Indexing and SQL syntax
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
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only