Starting with 7.3.00.29, SAP DB has the capability to return the last
value of a SERIAL (autoincrement) column to the client.

I know that I can make this work with sequences but I have huge project with
identity/auto increment in mind and don't want
to change every query..
(works on both MSSQL and MySQL)
All that you said is true, and i think, that this feature isn't properly documented yet. Even the HOW-TOs on sapdb.org haven't been updated and still state, that the last value of a DEFAULT SERIAL column connot be queried.

The thing you're searching for is the CURRVAL attribute/function. You can now use
SELECT test_table.currval from SYSDBA.DUAL
to get the last value used in the SERIAL column.

This feature has bean introduced in 7.3.0.29 and in 7.4.3.10, so that it is _not_ included in "beta1" (which is 7.4.3.7) of the 7.4series.

I hope i could help you
Sven




_______________________________________________
sapdb.general mailing list
[EMAIL PROTECTED]
http://listserv.sap.com/mailman/listinfo/sapdb.general

Reply via email to