开发者

What does this error mean? ([Microsoft][ODBC Excel Driver] The LEVEL clause includes a reserved word...)

开发者 https://www.devze.com 2023-04-05 11:11 出处:网络
Full error message: \"[Microsoft][ODBC Excel Driver] The LEVEL clause includes a reserved word or argument that is mispelled or missing, or the punctuation is incorrect\"

Full error message: "[Microsoft][ODBC Excel Driver] The LEVEL clause includes a reserved word or argument that is mispelled or missing, or the punctuation is incorrect"

I get this when trying to execute a query in one excel document against a table in another excel document. My SQL doesn't include LEVEL at all, and I can't find anything useful on Google.

Before anyone asks: Yes, I know excel isn't a database. I can't find a better way to get this data from sheet to sheet.

Because I like my job, I've obfuscated my SQL; otherwise it includes company confidential data. I am certain that my syntax is right on the things that I am removing, because it was written my Microsoft Query.

SELECT `Table1$`.`Field1`, <Other Fiel开发者_如何学编程ds from Table1>,
 `Table2$`.`FieldA`, <Other Fields from Table2>,
 `Table3$`.`FieldX`,
 `Table3$`.`FieldY`
FROM `<network path starting with \\>\<filename>.xlsb`.`Table1$` `Table1$`,
 `<network path starting with \\>\<filename>.xlsb`.`Table2$` `Table2$`,
 `<network path starting with \\>\<filename>.xlsb`.`Table3$` `Table3$`
WHERE `Table2$`.`Join1Field` = `Table1$`.`Join1Field`
 AND `Table3$`.`Join2Field` = `Table1$`.`Join2Field`
 AND `Table1$`.`Weeks Ago` < 14;

Note: All of these tables are in the same Excel file, and I'm using Excel 2007.


According to this page on MSDN you entered an SQL statement that has an invalid reserved word or incorrect punctuation. As @Ken White points out, it's hard to tell from your edited SQL what is going on.

IIRC when you use the GUI tool in MS Query it writes ODBC syntax: perhaps there is a problem in translation to native Access (ACE, Jet, whatever) syntax at the Excel end. If you can write SQL without GUI tools, or can use the Access QBE thing to do it for you, IIRC you can paste native Access SQL syntax into MS Query's SQL window and it will 'pass through' to Excel unchanged.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号