Hello, I am trying to write an INSERT query for DB2 using the Query D

Hello,

I am trying to write an INSERT query for DB2 using the Query Database Node that in some cases sets the value of VARCHAR field to NULL while in other cases it inserts an actual value.

The INSERT query is of the form "INSERT INTO <table> (..., <VARCHAR FIELD>", ...) VALUES (..., ac!VarcharField, ...)"

How can i write the expression for the value of the parameter ac!VarcharField so that it sets the Field to have a NULL value, depending on a condition, in the database?

Generally, in DB2, you set the field to NULL using the expression "CAST(NULL AS VARCHAR(10))".

Thanks for the help....

OriginalPostID-121205

OriginalPostID-121205

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Senior Developer
    We're using MS SQLServer, but we also have the issue that whenever using write to datastore entity and passing in nulls, Appian passes empty strings to varchar fields "". We have an enhancement request for this issue with reference number AN-53545. We've had to work around this by either accepting "" in the database, creating smaller CDTs that don't include the fields that are being left null (only works if we know those fields wouldn't be populated in that process), having triggers on the database that will set the fields to null, or using the Execute stored procedure plugin and creating stored procedures for our data writes.
Reply
  • 0
    Certified Senior Developer
    We're using MS SQLServer, but we also have the issue that whenever using write to datastore entity and passing in nulls, Appian passes empty strings to varchar fields "". We have an enhancement request for this issue with reference number AN-53545. We've had to work around this by either accepting "" in the database, creating smaller CDTs that don't include the fields that are being left null (only works if we know those fields wouldn't be populated in that process), having triggers on the database that will set the fields to null, or using the Execute stored procedure plugin and creating stored procedures for our data writes.
Children
No Data