1

スプレッドシートからデータを読み取っています。スプレッドシートの列の 1 つにスペースが含まれています。

たとえば、列名は [first name,last name,roll] です。

qryObjスプレッドシートを読んだ後に取得しています。今、クエリから名を読み取ろうとしているとき

<cfquery dbtype="query" name="getName">
    SELECT [first name]
    FROM   qryObj
</cfquery>

それはdbエラーを投げています。私も試してみまし['first name']たが、それでもエラーがスローされます。

エラーは次のとおりです。

Query Of Queries syntax error.
Encountered "[. Incorrect Select List, Incorrect select column
4

3 に答える 3

9

I did crazy stuff like googling to see what people had done in other situations, and tried various SQL approaches to escaping non-standard column names (back ticks, square barackets, double quotes, combos thereof) , and drew a blank. So I agree with @da_didi that QoQ/IMQ does not cater for this. You should raise a ticket in the Adobe bug tracker.

You could do SELECT *, which removes the need to reference the column name. Or you could serialize the query, use a string replace to rename the column, deserialise it again then QoQ on the revised name. I'd only do this with a small amount of data though.

Or you could push back on the owbner of the XLS file and say "no can do unless you revise your column names".

You could also perhaps suppress the column names as they stand from the XLS file using excludeHeaderRow,and then specify your own columns names. How did I find out one could do that? By RTFMing the <cfspreadsheet> docs.

于 2014-01-23T11:26:42.060 に答える
0

単純。選択をエイリアスするだけです。qryObjからFIRSTNAMEとして[FIRST NAME]を選択

于 2015-08-24T13:26:42.797 に答える