Page 1 of 1

How to insert NULL in a placeholder?

Posted: Thu Dec 10, 2015 7:04 pm
by barend.scholtus
Hi y'all
I use an INSERT SQL statement with revExecuteSQL and I use placeholders to fill in the values.
One of the values needs to be (SQL) NULL.

Unfortunately, "empty" and "null" are not SQL NULL, so my query inserts either an empty string or a \0. :(

How to insert NULL with revExecuteSQL with placeholders?

Re: How to insert NULL in a placeholder?

Posted: Thu Dec 10, 2015 7:51 pm
by barend.scholtus
I guess I found a pretty good solution myself (sorry, this usually happens *after* asking others for help :mrgreen: )
I just set the placeholder itself to "NULL", using: (assume placeholder 6 is the one that should be NULL)

Code: Select all

if tParams[6] is empty then
  replace ":6" with "NULL" in tSQL
end if