Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

According to H2 syntax documentation available here I should be able to execute a query like:

ALTER TABLE EMPLOYEE ADD COLUMN SECOND_NAME VARCHAR (124) AFTER FIRST_NAME;

However apparently only this query works:

ALTER TABLE EMPLOYEE ADD COLUMN SECOND_NAME VARCHAR (124);

Is it a mistake in the documentation or am I missing something? The BEFORE and AFTER parameters would be useful to me.

share|improve this question
1  
The order of the columns in a relational table is irrelevant. Just change them in your SELECT statements. –  a_horse_with_no_name Jun 12 '13 at 10:20
    
I know it is irrelevant in practice but in the documentation they have put this possibility for a reason. In my case it is that we often print the schema to paper and want some order for readability reasons. –  dendini Jun 12 '13 at 11:17

1 Answer 1

It works for me. The H2 change log says it was added in version 1.3.171. Here is the original bug

alter table credentials add column domain VARCHAR(255) after credentialType;

What didn't work for me was having multiple adds inside one alter.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.