Get next value of identity column

wes
2009-10-19
2014-01-19
  • wes

    wes - 2009-10-19

    Hello

    Is it possible to obtain the next value that will be used at an identity column using sql statements ?

    I have noticed that the value is written at .script after shutdown (for instance if my table has ID = 1 there is a line at .script that alter column id to start restart at 2). Is it possible to obtain this value ?

    Thank you very much for your attention.

    Best regards

     
  • Fred Toussi

    Fred Toussi - 2009-10-19

        The COLUMNS table has the properties of the identity columns, but not the next value for the sequence. For independent sequences, the SEQUENCES table has the next value info. The following show it for 1.9. For 1.8, the talbe names have a SYSTEM_ prefix. How do you intend to use this value? If it is generally useful, we may intoduce some functions for it.
        SET SCHEMA INFORMATION_SCHEMA
        SELECT * FROM SEQUENCES
        SELECT * from COLUMNS WHERE IS_IDENTITY = 'YES'

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks