Missing semicolon problem

Ask a Question related to Coldfusion Database Access, Design and Development.

  1. #1

    Default Missing semicolon problem

    I am getting the error of [Macromedia][SequeLink JDBC Driver][ODBC
    Socket][Microsoft][ODBC Microsoft Access Driver] Missing semicolon at end of
    SQL statement on the LAST insert of the following code, but I don't know why.



    <cfquery name="find_requestor_id" datasource="storage">
    SELECT requestor_id AS uid FROM requestors WHERE LIN = #LIN#
    </cfquery>
    <cfset uid = find_requestor_id.uid>

    <cfif find_requestor_id.recordcount LT 1>
    <cfquery datasource="storage">
    INSERT INTO requestors (firstname, lastname, LIN, email) VALUES
    ('#firstname#', '#lastname#', #LIN#, '#email#')
    </cfquery>
    <cfquery name="get_requestor_id" datasource="storage">
    SELECT MAX(requestor_id) AS luid FROM requestors
    </cfquery>
    <cfset uid = get_requestor_id.luid>
    </cfif>

    <cfquery datasource="storage">
    INSERT INTO requests (requestor_id) VALUES (<cfoutput>#uid#</cfoutput>) WHERE
    request_id=<cfoutput>#last_id#</cfoutput>
    </cfquery>

    TimMcGeary Guest

  2. Similar Questions and Discussions

    1. cfgrid and semicolon bug
      This problem was posted way back in 2005 but I have not seen a solution to it. When querying from a database a record that contains a semicolon and...
    2. Dynamic Excel Datasource - Insert -> missing semicolon
      When i try to access a dynamic ODBC resource to excel (with a insert statement) the odbc error : missing semicolon occurs. <CFQUERY name="insert"...
    3. semicolon requested
      Can someone help me on this. I'm trying to insert data into 2 tables using cf defined statements from the insert form wizard. When I run the code in...
    4. What does a semicolon do at the beginning of a line?
      Was browsing the documentation on reading a configuration file and found this. What does a semicolon do at the beginning of a line? ; <?php DO...
    5. how to output semicolon with php
      hi! thanx for reading! my problem: I want to print : 7] Xerox: print '<a href='. '"javascript:;"'. "onClick='hideAll(); showHideLayers...
  3. #2

    Default Re: Missing semicolon problem

    Are uid and last_id numeric?
    jdeline Guest

  4. #3

    Default Re: Missing semicolon problem

    yes. They are both auto-generated ids created by Access.
    TimMcGeary Guest

  5. #4

    Default Re: Missing semicolon problem

    INSERT INTO requests (requestor_id) VALUES (<cfoutput>#uid#</cfoutput>) WHERE
    request_id=<cfoutput>#last_id#</cfoutput>

    The syntax for the last INSERT statement is incorrect. You cannot use a WHERE
    clause with the INSERT ... VALUES syntax.

    Either use:

    INSERT INTO someTable (SomeColumn) VALUES (SomeValuesHere)....

    OR

    INSERT INTO someTable (SomeColumn)
    SELECT SomeValue
    FROM SomeTable
    WHERE SomeNumericColumn = #SomeNumber#

    Also, you don't need to use CFOUTPUT with the CFQUERY.

    Use ...
    INSERT INTO requests (requestor_id) VALUES (#uid#)

    Instead of ...
    INSERT INTO requests (requestor_id) VALUES ( <cfoutput>#uid#</cfoutput> )



    mxstu Guest

  6. #5

    Default Re: Missing semicolon problem

    Thank you. Even better, I will use an UPDATE - it was a brainfart that I
    didn't to begin with.

    Just to clarify, too, I am using a cftransaction, but I only posted a snippet
    of the code that was failing. Thank you for confirming that.

    And thank you for informing me that I don't need the <cfoutput> in the
    <cfquery>. That makes it much easier to read. :)

    TimMcGeary Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139