OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

hsqldb ALTER TABLE

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Base
View previous topic :: View next topic  
Author Message
Villeroy
Super User
Super User


Joined: 04 Oct 2004
Posts: 10106
Location: Germany

PostPosted: Thu Aug 17, 2006 10:13 am    Post subject: hsqldb ALTER TABLE Reply with quote

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. Shocked So I believe that I miss something very fundamental here.
_________________
Rest in peace, oooforum.org
Get help on https://forum.openoffice.org
Back to top
View user's profile Send private message
DrewJensen
Super User
Super User


Joined: 06 Jul 2005
Posts: 2616
Location: Cumberland, MD

PostPosted: Thu Aug 17, 2006 10:23 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
Villeroy
Super User
Super User


Joined: 04 Oct 2004
Posts: 10106
Location: Germany

PostPosted: Thu Aug 17, 2006 10:42 am    Post subject: Reply with quote

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 https://forum.openoffice.org
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Base All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group