[Solved] Alter Table Field

Creating tables and queries
Post Reply
capemayal1
Posts: 90
Joined: Fri Dec 31, 2010 5:16 pm

[Solved] Alter Table Field

Post by capemayal1 »

HSQLDB 2.0

Table = Table1

Fields= ID (primary key) Not autovalue; myname (VARCHAR) length = 50

I am unable to change any parameter of any field, example, can not change ID to autovalue = Yes from autovalue = No.

For the text field, I am unable to change the the length from 50 to 100 or from 50 to a lower number.

I must delete the field, and establish the field again, and ensure that I have selected the parameters.

Then, I must re-enter all the field's values.

Is there a solution to this?

Thank you.
Al
Last edited by capemayal1 on Mon Nov 21, 2011 12:34 am, edited 1 time in total.
User avatar
Sliderule
Volunteer
Posts: 1279
Joined: Thu Nov 29, 2007 9:46 am

Re: Alter Table Field

Post by Sliderule »

Since this is for HSQL 2.0 ( NOT for HSQL 1.8 as in OpenOffice default Version 3.3 and prior ):
  1. From the Menu: Tools -> SQL...
  2. In the Command to execute box, enter:

    Code: Select all

    ALTER TABLE "Table1" ALTER COLUMN "ID" GENERATED ALWAYS AS IDENTITY;
    
    ALTER TABLE "Table1" ALTER COLUMN "myname" VARCHAR(100);
    
  3. Press the Execute button
  4. Press the Close button
  5. From the Menu: View -> Refresh Tables
I hope this helps, please be su8re to let me / us know.

Sliderule

Thanks to add [Solved] in your 1st post Subject (edit button top right) if this issue has been resolved.
User avatar
DACM
Volunteer
Posts: 1138
Joined: Tue Nov 03, 2009 7:24 am

Re: Alter Table Field

Post by DACM »

capemayal1 wrote:HSQLDB 2.0...I am unable to change any parameter of any field...Is there a solution to this?
Other properties may have SQL- or GUI-based workarounds as well. See the following link for details:
The Frozen 'Field Property' Workaround (when using Base to create/adjust Table structures; applies to all external databases).

You may find other database management tools useful in this role as well.
.
AOO 4.1.x; LO 4.2.x; Windows 7/8 64-bit
Warning: Avoid embedded databases --> Solution: Adopt a portable 'split database' folder
Soli Deo gloria
Post Reply