As I said, I don't want to use the add constraint syntax, but rather the alter column one: http://www.h2database.com/html/grammar.html#alter_table_add http://www.h2database.com/html/grammar.html#column_definition
According to my understanding, my syntax is correct... Thx for your answer. On Friday, June 29, 2012 2:14:56 PM UTC+2, Noel Grandin wrote: > > read the documentation again. > http://www.h2database.com/html/grammar.html#alter_table_add_constraint > > On 2012-06-29 09:57, Multanis wrote: > > Hi ! > > I cannot figure out how I can add an unique column using H2. > According to documentation, this should work: > alter table testit add myuniquecol varchar(50) unique; > But I keep on getting error: > [Error Code: 42000, SQL State: 42000] Syntax error in SQL statement > "ALTER TABLE TESTIT ADD MYUNIQUECOL VARCHAR(50) UNIQUE[*] "; SQL statement: > alter table testit add myuniquecol varchar(50) unique [42000-166] > > Creating a table with similar syntax is working fine: > create table testit (id bigint primary key, uni varchar(50) unique); > > Can anyone help me on the correct syntax to use (or is this a bug ?) ? > > Thanks ! > > PS. I don't want to use separate add constraint, because my sql is > generated by liquibase > -- > You received this message because you are subscribed to the Google Groups > "H2 Database" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/h2-database/-/0ZdknA0PALgJ. > 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. > > > > -- You received this message because you are subscribed to the Google Groups "H2 Database" group. To view this discussion on the web visit https://groups.google.com/d/msg/h2-database/-/abbXuYsgrLIJ. 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.
