>> Am I to conclude that there is no way to use cfparam to set a date to null?

"null"'s do not exist in CF. the closest you'll get (esp comming from the form 
because all data on the form are strings) is "" (empty string).

you could also say how come "01/02/2005" fails on being a "true" date  - 
because it's still a string, not a date/time object (even the string "{ts 
'2005-02-01 00:00:00}" is still a string - it just looks like a date/time 
object).

keep in mind you're asking 2 diff questions. Code "null" and db storage of 
undefined values ("null") are not the same. 

your question was how to set a db field to "null". all you had to start with 
was a string

"" != NULL

that's why I suggested cfqueryparam and null="#YesNoFormat(not len(field))#". 
treat the empty string as CF's closes thing to a NULL. Deal with NULL's where 
it matters - in the db

makes sence?
barry.b





> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] Behalf Of Tom
> MacKean
> Sent: Thursday, 7 July 2005 10:36 AM
> To: CFAussie Mailing List
> Subject: [cfaussie] Re: cfparam for date
> 
> 
> Thank you all for your responses. I used an if statement in my sql and
> everything now works beautifully.
> 
> No one answered my original question. Am I to conclude that 
> there is no
> way to use cfparam to set a date to null?
> 
> Tom
> 
> 
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of
> [EMAIL PROTECTED]
> Sent: Wednesday, 6 July 2005 4:03 PM
> To: CFAussie Mailing List
> Subject: [cfaussie] Re: cfparam for date
> 
> On Wed, Jul 06, 2005 at 03:36:54PM +1000, Tom MacKean wrote:
> 
> > If users don't enter a date in a field, I want it to go into the
> > database as null.
> > 
> > However, 
> > 
> > <cfparam name="session.myevent.rsvpby" default="" type="date">
> > 
> > and
> > 
> > <cfparam name="session.myevent.rsvpby" default="null" type="date">
> > 
> > don't work.
> > 
> > What do I use for a default value of nothing when it's a date?
> 
> <cfqueryparam value="#DateFieldVar#" CFSqlType="CF_SQL_TimeStamp"
>   null="Yes">
> 
> You can go to the added step of making the null="Yes|No" into
> a function such as  null="#isNullDate(DateFieldVar)#" 
> which returns Yes or No dyamically. It's also a good place to
> trap user errors that the interface might have missed, such 
> as entering "Tuesday" in a DD/MM/YYYY field.
> 
> Cheers
> 
> Paul Haddon
> Technical Services Manager
> Formstar Print Technologies
> 
> 
> ---
> You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
> To unsubscribe send a blank email to
> [EMAIL PROTECTED]
> Aussie Macromedia Developers: http://lists.daemon.com.au/
> 
> NOTICE: Medical and scientific information provided in print 
> and electronically by Sydney IVF might not be relevant to 
> your own circumstances and should always be discussed with 
> your own doctor before you act on it. This communication is 
> confidential and may contain copyright or otherwise protected 
> information of Sydney IVF Limited or a third party. If you 
> are not the intended recipient of this communication please 
> immediately let us know by reply email or telephone us on +61 
> 2 9221 5964, delete the communication and destroy all copies.
> 
> 
> ---
> You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
> To unsubscribe send a blank email to 
> [EMAIL PROTECTED]
> Aussie Macromedia Developers: http://lists.daemon.com.au/
> 

---
You are currently subscribed to cfaussie as: [email protected]
To unsubscribe send a blank email to [EMAIL PROTECTED]
Aussie Macromedia Developers: http://lists.daemon.com.au/

Reply via email to