Question
Query of Qeries Syntax problem
I'm getting an error on the syntax for my SELECT statement in
a Query of Queries. The code is:
<cfquery name="OnOrderLogData" dbtype="Query" result="result3">
SELECT *,
ROW_NUMBER() OVER([ORDER] [BY] RowNumber [ASC]) + 0 AS PageOrder
FROM OOLogView
WHERE RowNumber > 3 AND RowNumber <= 33
</cfquery>
The error is:
Encountered "(. Incorrect Select Statement, Expecting a 'FROM', but encountered '(' instead, A select statement should have a 'FROM' construct.
I know that certain reserved words need to be escaped with square brackets, and I have surrounded all the words that were on the list in the reference manual with square brackets. I did not see anything in the reference manual that says I can not use parenthesis in the SELECT statement, nor anything that says I can not use the SQL function ROW_NUMBER. I have spent several hours trying many different things and still can't get it to work. It works fine when I execute it as an Ad Hoc query in SQL Server 2005 Studio Express (when I take out the square brackets).
Can anyone please help me figure out what is wrong and how to fix it? Thanks.
<cfquery name="OnOrderLogData" dbtype="Query" result="result3">
SELECT *,
ROW_NUMBER() OVER([ORDER] [BY] RowNumber [ASC]) + 0 AS PageOrder
FROM OOLogView
WHERE RowNumber > 3 AND RowNumber <= 33
</cfquery>
The error is:
Encountered "(. Incorrect Select Statement, Expecting a 'FROM', but encountered '(' instead, A select statement should have a 'FROM' construct.
I know that certain reserved words need to be escaped with square brackets, and I have surrounded all the words that were on the list in the reference manual with square brackets. I did not see anything in the reference manual that says I can not use parenthesis in the SELECT statement, nor anything that says I can not use the SQL function ROW_NUMBER. I have spent several hours trying many different things and still can't get it to work. It works fine when I execute it as an Ad Hoc query in SQL Server 2005 Studio Express (when I take out the square brackets).
Can anyone please help me figure out what is wrong and how to fix it? Thanks.
