| View previous topic :: View next topic |
| Author |
Message |
Villeroy Super User


Joined: 04 Oct 2004 Posts: 10065 Location: Germany
|
Posted: Thu Aug 17, 2006 10:13 am Post subject: hsqldb ALTER TABLE |
|
|
Base (builtin hsqldb) with OOo2.0.2 on Linux, JRE 1.4.2.
I copied the following lines from http://hsqldb.org/web/hsqlDocsFrame.html
ALTER TABLE <tablename> ALTER COLUMN <columnname> SET DEFAULT <defaultvalue>};
ALTER TABLE <tablename> ALTER COLUMN <columnname> SET [NOT] NULL
ALTER TABLE <tablename> ALTER COLUMN <columnname> RENAME TO <newname>
I copy one of the lines to a new query
I replace <tablename> with Table1 or "Table1"
I replace <columnname> with Field1 or "Field1"
I replace <defaultvalue> with -1 (currently 0)
I remove the trailing curly from the first line
I remove "[NOT]" from second line
I run with and without SQL-direct
None of them work
Err: This query does not generate a result set,... (which is quite understandable)
When I need to alter a table I copy the table, remove it, recreate the old table definition from scratch, copy the contents from the temporary copy and remove the copy. But in this forum I read several success stories with ALTER, UPDATE, DELETE. So I believe that I miss something very fundamental here. _________________ Rest in peace, oooforum.org
Get help on http://forum.openoffice.org |
|
| Back to top |
|
 |
DrewJensen Super User


Joined: 06 Jul 2005 Posts: 2616 Location: Cumberland, MD
|
Posted: Thu Aug 17, 2006 10:23 am Post subject: |
|
|
You don't use a query window for this.
Open the SQL window 'Tools>SQL'
Paste them in there and then execute them
Remember to end each line with a semi-colon for multiple commands. |
|
| Back to top |
|
 |
Villeroy Super User


Joined: 04 Oct 2004 Posts: 10065 Location: Germany
|
Posted: Thu Aug 17, 2006 10:42 am Post subject: |
|
|
| DrewJensen wrote: | You don't use a query window for this.
Open the SQL window 'Tools>SQL'
Paste them in there and then execute them
Remember to end each line with a semi-colon for multiple commands. |
Aaah, and doublequoting of identifiers is required.
Finally I can misuse a query for saving the commands since they seem not logged in database/log | database/script of the odb-file.
Thank you. _________________ Rest in peace, oooforum.org
Get help on http://forum.openoffice.org |
|
| Back to top |
|
 |
|