<cfif NOT form.myDate IS "" >
<cfquery ......
INSERT
INTO table (somedate)
VALUES (<cfqueryparam cfsqltype="cf_sql_date" value="#form.myDate#" )
</cfquery>
</cfif>
Main Topics
Browse All Topicswhen i run the insert query, it inserts null if there is no value selected for the field:
LeaperJPD's example below:
INSERT INTO table (<cfif NOT form.myDate IS "">, somedate</cfif> ) VALUES (<cfif NOT form.myDate IS "">, somedate</cfif> )
I do not understand how to make the Update statement function in the same way.... as in, if the user edits the form and still does not select a value i need the update statement to send a null value also.
Thanks in advance
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
erikt: sql2000
Jones911: yes, db allows nulls.
I use this for the insert statement and it inserts a null if there is no value selected:
INSERT INTO table (<cfif NOT form.myDate IS "">, somedate</cfif> ) VALUES (<cfif NOT form.myDate IS "">, somedate</cfif> )
but i do not know how to set up the update statment to act in the same way
currently, the insert statement functions perfectly and the update statement inserts 1/1/1900
aqx: i am about to try your example
Business Accounts
Answer for Membership
by: erikTsomikPosted on 2009-03-06 at 12:58:02ID: 23820966
can you update to 0 rather than null
Or try this
UPDATE TAble SET Name = NULL