How to insert NULL in a placeholder?

Creating desktop or client-server database solutions?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
barend.scholtus
Posts: 7
Joined: Tue Aug 18, 2015 7:25 am

How to insert NULL in a placeholder?

Post by barend.scholtus » Thu Dec 10, 2015 7:04 pm

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?

barend.scholtus
Posts: 7
Joined: Tue Aug 18, 2015 7:25 am

Re: How to insert NULL in a placeholder?

Post by barend.scholtus » Thu Dec 10, 2015 7:51 pm

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

Post Reply

Return to “Databases”