First of all you have your SQL statement in the wrong order
It should be
UPDATE
SET
WHERE
Secondly now in cf is #Now()# not #now#. That is of course if you haven't
set a variable higher up in your template called now. If you do have one I
would suggest renaming it to something else to avoid confusion.
--K
> -----Original Message-----
> From: Jacob [SMTP:[EMAIL PROTECTED]]
> Sent: Monday, July 31, 2000 11:34 AM
> To: [EMAIL PROTECTED]
> Subject: Insert date and time into database
>
> I want to insert the date and time into a sql database. Here is want I am
> trying to do:
>
> <cfset now=createodbcdatetime(now())>
> <cfquery name="resettime" datasource="hits">
> update hitclear
> where table_id = 'reeldemand'
> set cleardate = '#now#'
> </cfquery>
>
> But, I get the following error:
>
> Error Diagnostic Information
> ODBC Error Code = 37000 (Syntax error or access violation)
> [Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near the
> keyword 'where'.
> SQL = "update hitclear where table_id = 'reeldemand' set cleardate = '{ts
> '2000-07-31 11:12:22'}'"
> Data Source = "hits"
> SQL = "update hitclear where table_id = 'reeldemand' set cleardate = '{ts
> '2000-07-31 11:12:22'}'"
> The error occurred while processing an element with a general identifier
> of
> (CFQUERY), occupying document position (7:1) to (7:44) in the template
> file
> D:\html\counter.htm
> The specific sequence of files included or processed is:
> D:\HTML\COUNTER.HTM .
> Date/Time: 07/31/00 11:12:22
>
> I did have it working, but it was almost 8 lines of coding to set the date
>
> and time. I Would like to shorten the code to speed up the template.
>
> Any suggestions?
>
> Thanks
> Jacob
>
> --------------------------------------------------------------------------
> ----
> Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
> 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/cf-talk@houseoffusion.com/
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.