ALTER TABLE ... DROP COLUMN IF EXISTS misbehaves?

1,149 views
Skip to first unread message

Nick99

unread,
Jul 14, 2011, 5:52:49 PM7/14/11
to H2 Database
Hi,

H2 1.3.157

I'm trying to drop a column /via console/ if it exists:

>ALTER TABLE TEST DROP COLUMN IF EXISTS 'UUID'
>Column "IF" not found; SQL statement:
ALTER TABLE TEST DROP COLUMN IF EXISTS 'UUID' [42122-154] 42S22/42122
(Help)

however, http://www.h2database.com/html/grammar.html?highlight=grammar&search=gramm#alter_table_drop_column
states that "IF EXISTS" is a valid token.

Any help would be appreciated.

Thanks!

Thomas Mueller

unread,
Aug 2, 2011, 2:19:11 PM8/2/11
to h2-database
Hi,

Possibly this was not supported in version 1.3.154. This works in the
current version:

ALTER TABLE TEST DROP COLUMN IF EXISTS UUID;

Please note you can't use single quotes around UUID.

Regards,
Thomas

Reply all
Reply to author
Forward
0 new messages