Le 31/05/12 19:21, Andreas Säger a écrit :
ALTER TABLE "table name" ALTER COLUMN "column name" SET DEFAULT
I just tried that, and what do you know, it didn't work :
With an existing hsqldb db Table containing :
ID int autoincrement=YES
PRIMARY KEY = ID
I filled the table with a few records, save, quit, restart, reload.
I then added a date field called dtchg (defined as DATE not DATE/TIME).
I left made this field non-nullable, then saved the table definition,
quit the app, restarted.
Opened ODB file, went to Tools SQL and entered the command you indicated :
Command executed successfully. OK, I thought, lets try it out.
Opened the table for data entry, nothing in the date field, fair enough,
I didn't ask it to update the previous entries.
Tried entering a new tuple. Tab between fields, when I get to the last
field, i.e. the dtchg field, I leave blank and press Tab. Error !!
"Attempt to insert null into a non-nullable column: column: ID table:
seq3 in statement [INSERT INTO "seq3" ( "numseq","typeseq") VALUES ( ?,?)]"
OK, I thought, it can't handle automatically filling the dtchg field
with what is supposed to be an automatically provided entry. Abandon the
changes, and close the table.
So, I re-edit my table properties and try to turn the field into
something which can be NULL, save the definition, save the db, quit,
Tried entering a new tuple, tabbing between fields. Get to the dtchg
field : Error !!! Same bloody message. So for some reason the change
from non-nullable to nullable wasn't registered.
Go figure. If I do this with mysql (via non Base tools, eg. CLI or
phpmyadmin), it works.
For unsubscribe instructions e-mail to: email@example.com
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be deleted
Impressum (Legal Info)
: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (MPLv2
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our trademark policy