Either use

<cfquery name="Insert" datasource="lsars">
        insert into taavon.history
(lid,summary,completedby,assignedby,comptime)
        values ('#url.lid#',
'#form.summary#','#url.assigned#','',#CreateODBCDateTime(Now())#)
</cfquery> 

Or

<cfquery name="Insert" datasource="lsars">
        insert into taavon.history
(lid,summary,completedby,assignedby,comptime)
        values ('#url.lid#', '#form.summary#','#url.assigned#','',Now())
</cfquery> 

If you're using SQL server you can use

<cfquery name="Insert" datasource="lsars">
        insert into taavon.history
(lid,summary,completedby,assignedby,comptime)
        values ('#url.lid#', '#form.summary#','#url.assigned#','',GetDate())
</cfquery> 

Or 

<cfquery name="Insert" datasource="lsars">
        insert into taavon.history
(lid,summary,completedby,assignedby,comptime)
        values ('#url.lid#', '#form.summary#','#url.assigned#','',sysdate)
</cfquery> 

HTH,
--K

> -----Original Message-----
> From: James Taavon [SMTP:[EMAIL PROTECTED]]
> Sent: Monday, July 31, 2000 11:07 AM
> To:   [EMAIL PROTECTED]
> Subject:      Re: Custom Tag for Date and Time
> 
> Philip,
> 
> I tried this...
> 
> <cfquery name="Insert" datasource="lsars">
>       insert into taavon.history
> (lid,summary,completedby,assignedby,comptime)
>       values ('#url.lid#', '#form.summary#','#url.assigned#','',#Now()#)
> </cfquery> 
> 
> 
> 
> and got an error...
> 
> ODBC Error Code = 22008 (Datetime field overflow)
> 
>  [IBM][Client Access ODBC Driver (32-bit)][DB2/400 SQL]SQL0180 - Syntax
> of date,
>  time, or timestamp value not valid.
> 
>  The error occurred while processing an element with a general
> identifier of (CFQUERY),
>  occupying document position (9:1) to (9:42).
> 
> Any ideas?
> 
> 
> Philip Arnold - ASP wrote:
> > 
> > > Any one have a custom tag that retrieves both the DateFormat (Now())
> and
> > > TimeFormat (Now()) as one function that can be inserted into a
> database?
> > 
> > I assume you've got your field as a DateTime format - if not, then
> change it
> > to be DateTime
> > 
> > Also, try to use the database native functions - Now() for Access and
> > GetDate() for SQL Server - it'll be faster and cleaner than getting CF
> to do
> > the work
> > 
> > If you really want to use CF to do it, then use
> > #CreateODBCDateTime(Now())# - assuming you're talking to the database
> ODBC
> > and not OLE DB
> > 
> > Try not to use DateFormat and TimeFormat into a format that "looks"
> right
> > for you - the database server may look at is as just some text and
> produce
> > an error - if you're fixed on the idea of using a set DateFormat, then
> use
> > one that isn't ambigious, like "d mmm yyyy", that way, it can't be
> > confused - DEFINITELY avoid formats like "mm/dd/yyyy" as some databases
> may
> > interpret it as "dd/mm/yy" (depending on nationalisation)
> > 
> > HTH
> > 
> > Philip Arnold
> > ASP Multimedia Limited
> > T: +44 (0)20 8680 1133
> > 
> > "Websites for the real world"
> > 
> > **********************************************************************
> > This email and any files transmitted with it are confidential and
> > intended solely for the use of the individual or entity to whom they
> > are addressed. If you have received this email in error please notify
> > the system manager.
> > **********************************************************************
> > 
> >
> --------------------------------------------------------------------------
> ----
> > Archives: http://www.mail-archive.com/[email protected]/
> > To Unsubscribe visit
> http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
> send a message to [EMAIL PROTECTED] with 'unsubscribe' in
> the body.
> --------------------------------------------------------------------------
> ----
> Archives: http://www.mail-archive.com/[email protected]/
> To Unsubscribe visit
> http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
> send a message to [EMAIL PROTECTED] with 'unsubscribe' in
> the body.
------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to