Ask a Question related to Coldfusion Database Access, Design and Development.
-
TimMcGeary #1
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
-
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... -
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"... -
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... -
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... -
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... -
-
TimMcGeary #3
Re: Missing semicolon problem
yes. They are both auto-generated ids created by Access.
TimMcGeary Guest
-
mxstu #4
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
-
TimMcGeary #5
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



Reply With Quote

