Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

datetime problem

Posted on 2003-12-05
2
Medium Priority
?
207 Views
Last Modified: 2013-12-24
i have some datetime value in an employee database (datetime field in sql).  everytime i send over a blank value when i update or add something it comes back with 1/1/1900 value.  how do i send a blank value to a datetime field?

0
Comment
Question by:tpiazza
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 9

Accepted Solution

by:
shooksm earned 200 total points
ID: 9882702
First, use CFPARAM tag to set a default value:

<cfparam default="" name="FORM.SomeDateField">

Then use the CFQUERYPARAM tag and the NULL attribute on the date field:

<cfquery ...>
INSERT INTO SomeTable (SomeDateField)
        (<cfqueryparam cfsqltype="cf_sql_timestamp" null="#YesNoFormat(Trim(FORM.SomeDateField) EQ "")#" value="#FORM.SomeDateField#">)
</cfquery>

The cfqueryparam tags null attribute can be used to send a NULL value to the database, which is essentially a blank value as long as the field accepts null values.  The YesNoFormat function returns back a yes if the FORM.SomeDateField is blank and no if it contains data.
0
 
LVL 17

Expert Comment

by:anandkp
ID: 9883443
Set default to null !
I dont see why u want to update it !
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
What You Need to Know when Searching for a Webhost Provider
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question