Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2002
    Location
    Nottingham, UK
    Posts
    37

    Unanswered: syntax error on INSERT with a date datatype

    hello,

    I keep getting a SQL syntax error for the following statement using coldfusion:

    <CFQUERY NAME="InsertTaskReport" DATASOURCE="#request.dsn#">
    INSERT INTO DDtasking(projectID, userID, <cfif trim(len(thisDate2))>date,</cfif> hours)
    VALUES(#projectID#, #session.userID#, <cfif trim(len(thisDate2))>#createodbcdatetime(thisDate2 )#,</cfif>
    #Decimalformat(thisHours2)#)
    </CFQUERY>

    whic turns into this when processed by CF Server:

    INSERT INTO DDtasking(projectID, userID, date, hours) VALUES(50, 114, {ts '2003-02-12 00:00:00'}, 3.00)

    Do any of you see a problem with this statement?

  2. #2
    Join Date
    Jan 2002
    Location
    Nottingham, UK
    Posts
    37

    Talking oh oops

    cant seem to delete my post.

    i just found out that my db table's column can't be called "date". duh. oops. renamed my column. problem solved.
    ----
    system:
    Mac Powerbook 1GHz

  3. #3
    Join Date
    Jan 2003
    Posts
    126
    I can be named date, but in your query you need to surround it with brackets..

    [date]

    Ken

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •