Subject | Beginnig is hard - Triggers and Not NULL |
---|---|
Author | gigmbh |
Post date | 2002-01-11T18:51:53Z |
Imagine the follwing:
1.) You have a db field "Description" which must not be NULL.
2.) You have a trigger which sets this field to a computed value if
the user leave it blank but if the user specifies it the user's value
is taken.
The problem seems to be that the field "Description" is allways
included in the sql insert statement even when NULL and so you are
running into the "must not be null" exception.
I found out how to get this to work with generators (by the property
GeneratorsLink) or with default values (with the property
GetServerDefaults) but I'm absolutely clueless how to solve it with
this kind of trigger.
Maybe I missed anything but is there a property to specify to omit
column values in the sql insert statement if they are NULL?
Thank's.
Kind Regards,
Frank.
1.) You have a db field "Description" which must not be NULL.
2.) You have a trigger which sets this field to a computed value if
the user leave it blank but if the user specifies it the user's value
is taken.
The problem seems to be that the field "Description" is allways
included in the sql insert statement even when NULL and so you are
running into the "must not be null" exception.
I found out how to get this to work with generators (by the property
GeneratorsLink) or with default values (with the property
GetServerDefaults) but I'm absolutely clueless how to solve it with
this kind of trigger.
Maybe I missed anything but is there a property to specify to omit
column values in the sql insert statement if they are NULL?
Thank's.
Kind Regards,
Frank.