It doesn't work, occured this exception:
Exception in thread "main" org.h2.jdbc.JdbcSQLException: Timeout
trying to lock table SYS [50200-69]
at org.h2.message.Message.getSQLException(Message.java:91)
at org.h2.message.Message.getSQLException(Message.java:95)
at org.h2.message.Message.getSQLException(Message.java:73)
at org.h2.table.TableData.lock(TableData.java:377)
at org.h2.engine.Database.removeMeta(Database.java:698)
at org.h2.engine.Database.update(Database.java:1112)
at org.h2.schema.Sequence.flush(Sequence.java:104)
at org.h2.table.Column.updateSequenceIfRequired(Column.java:269)
at org.h2.table.Column.validateConvertUpdateSequence(Column.java:251)
at org.h2.table.Table.validateConvertUpdateSequence(Table.java:469)
at org.h2.command.dml.Insert.update(Insert.java:117)
at org.h2.command.ddl.AlterTableAlterColumn.execute
(AlterTableAlterColumn.java:368)
at org.h2.command.ddl.AlterTableAlterColumn.copyData
(AlterTableAlterColumn.java:316)
at org.h2.command.ddl.AlterTableAlterColumn.update
(AlterTableAlterColumn.java:152)
at org.h2.command.CommandContainer.update(CommandContainer.java:69)
at org.h2.command.Command.executeUpdate(Command.java:197)
at org.h2.jdbc.JdbcStatement.execute(JdbcStatement.java:154)
When running this statement: alter table test alter column id
identity;
On 4 fev, 15:07, Thomas Mueller <[email protected]> wrote:
> Hi,
>
> You need to drop the primary key constraint first, because primary key
> columns can't be altered:
>
> drop table test;
> create table test(id int primary key);
> insert into test values(1), (2), (3);
> alter table test drop primary key;
> alter table test alter column id identity;
>
> Regards,
> Thomas
>
>
>
> On Wed, Feb 4, 2009 at 6:56 PM, rafael <[email protected]> wrote:
>
> > I've already a column and it's a primary key. Can I change the column
> > to be "auto_increment"?
>
> > Thanks
>
> > Rafael- Ocultar texto entre aspas -
>
> - Mostrar texto entre aspas -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "H2
Database" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/h2-database?hl=en
-~----------~----~----~----~------~----~------~--~---