cfqueryparam and the null attribute

Sometimes its necessary to insert a null value into a column in a database. For example if the length of a string is blank, you may prefer null rather than a blank entry. Here is one way to achieve this without cfqueryparam: Here is another way with the cfqueryparam tag Both are a bit messy […]
March 19, 2007 7:41 pm

Sometimes its necessary to insert a null value into a column in a database. For example if the length of a string is blank, you may prefer null rather than a blank entry. Here is one way to achieve this without cfqueryparam:

Here is another way with the cfqueryparam tag

Both are a bit messy right? Well how about we get these into one nice, tidy bit of code. This is where the null attribute of cfqueryparam comes in:

This simply says, give me a yes if the length of string Intro is 0. This then makes the query insert a null.

Leave a Comment