Hmm ok, that's sad, but I can live with it ;-)

(Maybe the documentation should be updated so)

Thanks anyway !

On 29/06/2012 15:08, Noel Grandin wrote:

Sorry that syntax only works in the CREATE TABLE statement, not in ALTER TABLE.

On 2012-06-29 14:55, Multanis wrote:
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
    <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
    <https://groups.google.com/d/msg/h2-database/-/0ZdknA0PALgJ>.
    To post to this group, send email to
    [email protected] <mailto:[email protected]>.
    To unsubscribe from this group, send email to
    [email protected]
    <mailto:[email protected]>.
    For more options, visit this group at
    http://groups.google.com/group/h2-database?hl=en
    <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.




--
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.

Reply via email to