12 Replies Latest reply on Feb 24, 2015 6:59 AM by prabhup99504277

    Please help me insert NULL for a date


      I have 2 date fields. I would like to be able to leave them blank and have the database create a NULL.


      This works fine but only if I have the 2 date fields listed last in my insert statement. If I add any below the 2 shown below, the fields are populated with: 01/01/1900. For example, I can't add the "LastModifiedBy" field below the 2 shown below otherwise it will fill in that database field with 01/01/1900.


      Does anyone know what could be causing this? Thank you.



        <cfqueryparam value = "#ARGUMENTS.LastModifiedBy#" CFSQLType = "CF_SQL_VARCHAR">,  

        <cfif StructKeyExists( ARGUMENTS, "DateField1" )>
         <cfqueryparam value="#arguments.DateField1#" cfsqltype="CF_SQL_DATE">, 
         <cfqueryparam value="" cfsqltype="CF_SQL_DATE" null="yes" >,

        <cfif StructKeyExists( ARGUMENTS, "DateField2" )>
         <cfqueryparam value="#arguments.DateField2#" cfsqltype="CF_SQL_DATE"> 
         <cfqueryparam value="" cfsqltype="CF_SQL_DATE" null="yes" >