Quantcast
Channel: Adobe Community : Discussion List - ColdFusion
Viewing all articles
Browse latest Browse all 6243

Please help me insert NULL for a date

$
0
0

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">, 
  <cfelse>
   <cfqueryparam value="" cfsqltype="CF_SQL_DATE" null="yes" >,
  </cfif>

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


Viewing all articles
Browse latest Browse all 6243


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>