[Zope] setting date to Null in MS SQL?

McDonnell, Larry lmcdonnell@protonenergy.com
Thu, 22 May 2003 09:22:23 -0400


Hi,

I do this within the zsql method - 

<dtml-if creation_date><dtml-if "creation_date==''">NULL<dtml-else>
 <dtml-sqlvar creation_date type=string></dtml-if><dtml-else>NULL</dtml-if>

Chris Kratz provided me with this awhile ago. Hope this helps.

-----Original Message-----
From: Kelley, Sean [mailto:SKelley@ci.santa-rosa.ca.us]
Sent: Wednesday, May 21, 2003 6:38 PM
To: 'zope@zope.org'
Subject: [Zope] setting date to Null in MS SQL?


I have a simple app where I need to let people set dates to null via a form.
I am trying to test for an empty form field and set the value to NULL if
empty.  It seems to work on form submission but when I do a database query I
see it is actually set to 1/1/1900
I have found a way to update a record if it already has a value and you
clear the form field, but for some reason this same method does not work for
an initial insert.

In both of my sql methods I have:

<dtml-if "AppDelDate==''">
       AppDelDate=NULL,
 <dtml-else>
       '<dtml-var name="AppDelDate" sql_quote>',
 </dtml-if>

What am I missing?

_______________________________________________
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )