Subject | Re: [ib-support] Problem with Timestamp field |
---|---|
Author | Svein Erling Tysvær |
Post date | 2001-08-09T08:04:41Z |
>I have the following line declared in my Firebird database metadata:Maybe DateEntered is null? Or that you're assigning at the wrong time or to
> DATE_ENTERED TIMESTAMP NOT NULL,
>However, this is causing a problem with my code - it is refusing to post a
>new record because it says this field is null. It's not however, in my code
>the following line sets the value:
>dstBookDATE_ENTERED.Value := DateEntered;
>DateEntered is a variable of type TDateTime.
>So where is the problem?
the wrong column? I don't know what tool you are using, but my experience
(with IBO) is that if it complains that a field is null, then the field is
null and I've done a mistake somewhere...
>Also, is there an easy way to alter this so that it is not NOT NULL?1) Make a backup (which you - of course - always do)
2) Create a temporary column (ALTER TABLE ... ADD TEMP TIMESTAMP)
3) Copy the contents of DATE_ENTERED to TEMP
4) Delete the column DATE_ENTERED
5) Create the column DATE_ENTERED without not null
6) Copy the contents of TEMP to DATE_ENTERED
7) Delete TEMP
There should be quicker ways altering system tables directly, but this is a
pretty safe way to do things.
HTH,
Set