Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 10.0.1 » UltraLite - M-Business Anywhere Programming » UltraLite for M-Business Anywhere API Reference » Connection class

 getLastDownloadTime method Next Page

getLastIdentity method

Returns the most recent identity value used.


UInt64 getLastIdentity()


This function is equivalent to the following SQL statement:

  SELECT @@identity

The function is particularly useful in the context of global autoincrement columns. The returned value is an unsigned 64-bit integer, database data type UNSIGNED BIGINT. Since this statement only allows you to determine the most recently assigned default value, you should retrieve this value soon after executing the insert statement to avoid spurious results.

Occasionally, a single insert statement may include more than one column of type global autoincrement. In this case, the return value is one of the generated default values, but there is no reliable means to determine which one. For this reason, you should design your database and write your insert statements so as to avoid this situation.