Pinned topic How to get MAX from multiple tables
G.Paulus 270005DCXW10 Posts
Re: How to get MAX from multiple tables2014-01-30T13:26:49ZThis is the accepted answer. This is the accepted answer.
you can query the syscat view SYSCAT.COLIDENTATTRIBUTES with the following select statement to get the next cached first value for the identity columns of all tables.
SELECT MAX(NEXTCACHEFIRSTVALUE) FROM SYSCAT.COLIDENTATTRIBUTES
Use this value for update and you are safe from getting duplicates.