Subject Re: Defaults and triggers
Author mmenaz
I use native components (IB_xx), but I think that the problem is the same.
Default are applied by the server if NO value is given, and with no value I mean really nothing (including null).
So when you use TIBOTable and the field has null value, IBOTable sends it to the server, that thinks you WANT to assign null to that field.
Using SQL-statement, I'm sure you OMIT that field in the SQL, so to the server is given nothing regarding that field, and the server will use the default value.
So you can use a query that omits that field, or you have to retrieve the default value from the server, or force it from the client side.
With native components, there is "getserverdefaults" property in the IB_Query that retrieves all fields defaults from the server...
Hope this will help :)
Merry Cristmas
Marco Menardi

--- In IBObjects@y..., Gerard J.M.Houtenbos <gh@d...> wrote:
> I use the TIBOTable in a converted non-SQL-application.
> I use a field, not null with a default value.
> When I insert a record using TIBOTable.Insert and Post without
> giving the field a value, then an exception is generated saying
> that the field cannot be null.
> If I use a SQL-statement to insert the record, then the default
> value is accepted correctly.
> I have the same experience with Before-Insert-Triggers.
> Is this correct or do I make a mistake?
> tia,