SewHelpMe wrote:
This is my first time using LibreOffice Base and in case I'm not very clear
... I haven't programmed anything in almost 15 years so this is a bit of a
transition for an old lady.
I'm creating a table and I want a field to be of type Integer and Not Null.
(Note: I already have another field in the same table that is with the same
configuration, ie Integer/Not Null, and I'm editing an existing table to add
this field.)
I keep getting the error message:
Error while saving the table design
Column constraints are not acceptable in statement [ALTER TABLE "Companion
Subspecies" ADD "Help Type" INTEGER NOT NULL]
Could someone kindly point me in the right direction to correct my problem?
Thank you.
--
View this message in context: http://nabble.documentfoundation.org/Integer-Not-Null-tp3990551.html
Sent from the Users mailing list archive at Nabble.com.
I had to read your email another time to understand what you were saying.
The SQL for altering a table by adding a field is:
ALTER TABLE <tablename> ADD [COLUMN] <columnname> Datatype
[(columnSize[,precision])] [{DEFAULT <defaultValue> |
GENERATED BY DEFAULT AS IDENTITY (START WITH <n>[, INCREMENT BY <m>])}] |
[[NOT] NULL] [IDENTITY] [PRIMARY KEY]
[BEFORE <existingcolumn>];
From what I read, "Companion Subspecies" is the table's name and "Help type" is the field's name. Putting these into the SQL statement:
ALTER TABLE "Companion Subspecies" ADD COLUMN "Help type" INTEGER NOT NULL;
Looks like you used ADD instead of ADD COLUMN.
I have added an attachment to this email for your personal use: the HSQLDB user guide version 1.8. (This guide is for the version of HSQLDB used by Base.) This should help you refresh your memory.
--Dan