John Gregson wrote:

However after setting up a Table and a Form; I just
found that I had left out an important field in the Table.
Is there any way to insert another field into the existing Table;

Hello John,

Base has, in most instances, two ways to edit a tables structure. The GUI table editor and the SQL command.

In the case of the GUI editor new fields can be added to the end of a table, not not inserted between two existing fields, or placed at the beginning of the table.

Using a SQL command, against any Base file that accepts SQL directly, you can insert fields. SQL commands use the syntax for the specific database 'this' Base file happens to be working with.

So - if you just created a Base file with default settings this would mean the command in it's simplest format would be:

ALTER TABLE <tableName> ADD COLUMN <columnName> <dataType> BEFORE <someColumnName>

You enter an SQL command in the SQL window - with the Base file opened select Tools>SQL

If your table where named myTable with columns Col1, Col3, Col4. OOps left out Col2 so.

ALTER TABLE "myTable" ADD COLUMN "Col2" VARCHAR(50) BEFORE "Col3"

When you use the execute button in the SQL window the system should reply "Command executed successfully" ! The table now has fields, Col1, Col2, Col3, Col4, OOps
:>)
or it could show an error if you make a mistake.

For a full version of the commands options please refer to the HSQLdb documentation http://hsqldb.org/web/hsqlDocsFrame.html scroll down to the ALTER TABLE command.

HTH

Drew



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to