Wednesday, May 7, 2014

Check if the next value of a Identity column is lower than max value of that column in table on DB2/Z

compare result of query:
select a.DCREATOR as tabschema,a.dname as tabname, a.dcolname as column_name,a.dtype as TYPE_OF_DEPENCY,maxassignedval as last_value from sysibm.syssequencesdep  a join sysibm.syssequences b on a.bsequenceid=b.sequenceid where dtype='I'


select max(<column name>) from <table schema>.<table name>;

If the first query it's value is lower than the second value, this could indicate that you will encounter primary key conflict in this column

No comments:

Post a Comment