Board index » delphi » Problem with default Values

Problem with default Values

Hi all,

i have the following problem with default values. When i set a default value
in a field in DDL, and i try to post a new record using IBDataSet then, even
thought i don't provide a value for this field, the default value is not
inserted. Can anyone help ?

Thanks in advance.

I am using D5.01 + IB6.0.1.6 + IBX5.02

 

Re:Problem with default Values


You need to define your field not null in order to set a default value.

regards, clemens

"Stefanos Charalampous" <s.xaralamp...@athos.pouliadis.gr> schrieb im
Newsbeitrag news:3c175f9f_1@dnews...

Quote
> Hi all,

> i have the following problem with default values. When i set a default
value
> in a field in DDL, and i try to post a new record using IBDataSet then,
even
> thought i don't provide a value for this field, the default value is not
> inserted. Can anyone help ?

> Thanks in advance.

> I am using D5.01 + IB6.0.1.6 + IBX5.02

Re:Problem with default Values


Quote
Stefanos Charalampous wrote:

> i have the following problem with default values. When i set a default value
> in a field in DDL, and i try to post a new record using IBDataSet then, even
> thought i don't provide a value for this field, the default value is not
> inserted. Can anyone help ?

        DEFAULTs only apply if the column in question is entirely unmentioned in
your InsertSQL.  Check your InsertSQL and make sure the column is not there.

        If you *need* the column in your InsertSQL, then DEFAULT won't do what
you want.  Instead, use a BEFORE INSERT trigger to set the value of the
column if the state passed is NULL.

        HTH,

        -Craig

--
  Craig Stuntz (TeamB) Vertex Systems Corp. Columbus, OH
We're hiring: http://www.vertexsoftware.com/careerops.htm#sd
      Delphi/InterBase WebLog: http://delphi.weblogs.com

Other Threads