identity column

65 views
Skip to first unread message

Igal

unread,
Jun 18, 2012, 4:34:29 PM6/18/12
to h2-da...@googlegroups.com
hi,

I migrated a database from MSSQL to H2.

when I insert a record to a table with an identity column that already has records, I expect the new record to have the highest id, but it does not.

any ideas?

thanks

Igal

unread,
Jun 18, 2012, 4:49:22 PM6/18/12
to h2-da...@googlegroups.com
please ignore this thread.

I copied the table from schema to public and the identity constraint was lost in the process.  I fixed it by executing

ALTER TABLE table_name
  ALTER COLUMN column_name
    INT NOT NULL IDENTITY;

ALTER TABLE  table_name  
  ALTER COLUMN column_name
      RESTART WITH 100000;


thank you.
Reply all
Reply to author
Forward
0 new messages