I've got a database that could have a value within the fields. Circumstance might need to take away the initial value and change it having a NULL.
Just how can NULL values be placed within an empty area?
You'd write a question that's something similar to this:
<cfquery name="queryName" datasource="dsn"> UPDATE tableName SET fieldName = NULL WHERE recordId = <cfqueryparam cfsqltype="cf_sql_integer" value="#recordId#" /> </cfquery>
Also, there's a noticeable difference between an empty string along with a NULL value. The one thing to keep in mind about NULL is it does not associate to not NULL. It does not associate to non-NULL values. If you have three records inside your table:
ID VALUE 1 15 2 NULL 3 30
Advertising media are this question:
SELECT ID from tableName where value != 15
you will simply get record 3. The best way to make certain record 2 is incorporated within the resultset would be to change your query as a result:
SELECT ID from tableName where coalesce(value,16) != 15
The objective of coalesce is to determine the first parameter for NULL-ness, and employ the need for the 2nd parameter rather when the first parameter is NULL. Within the above example, I have put '16' because the second parameter, but you should use any value you would like as lengthy as it is different then what you are evaluating for (within this situation, 15).