select officer code ,total from [$staff record ]
Here is the sample SQL.
这是示例SQL。
Officer code is one of the field name in excel with two words.
官员代码是excel中具有两个单词的字段名称之一。
Staff record is one of the table name in excel with two words .
员工记录是excel中的表名之一,有两个单词。
**What is the correct syntax to call these two items without changing the excel structure ?
**在不更改excel结构的情况下调用这两个项目的正确语法是什么?
update
It is not working for using [officer code]
它无法使用[官员代码]
1 个解决方案
#1
2
It is not clear from the picture, what content cell A1
actually contains. It is formatted as "Wrap Text". So it can contain officer code
or officer code
or officer code
with 1, 2, 3, ... blanks between officer
and code
. The cell wraps this text if it is small enough. Or it can contain officer\ncode
or officer\n code
or officer \ncode
in any possible combinations. So you should detect at first what content cell A1
actually contains.
从图中不清楚,实际上包含什么内容单元格A1。它被格式化为“自动换行”。所以它可以包含官方代码或官员代码或官方代码,在officerand代码之间有1,2,3,...空格。如果文本足够小,则单元格将其包装。或者它可以包含任何可能的组合中的官员\ n代码或官员\ n代码或官员\ ncode。因此,您应该首先检测A1实际包含的内容单元格。
If it is officer\ncode
:
如果是官员\ ncode:
You really should not have field names containing line feeds with ADO. But if you have you can use an underscore instead of the line feed within the field name.
你真的不应该有包含ADO换行符的字段名称。但是如果你有,你可以在字段名称中使用下划线而不是换行符。
Example:
例:
If the Excel sheet name is staff record
and the column header is
如果Excel工作表名称是人员记录而列标题是
officer
code
where there is a line feed between officer and code,
官员和代码之间有换行的地方,
then the following select should work:
然后以下选择应该工作:
Select [officer_code] from ['staff record$']
The annoying thing with this is that one cannot see in the view whether there are not even more weird things. For example if there is a space after officer
before the line feed, then it is [officer _code]
.
令人烦恼的是,在视图中看不到是否有更奇怪的东西。例如,如果在换行之前有一个空格后的空格,那么它是[官员_code]。
So, you really should not have field names containing line feeds.
所以,你真的不应该有包含换行符的字段名称。
#1
2
It is not clear from the picture, what content cell A1
actually contains. It is formatted as "Wrap Text". So it can contain officer code
or officer code
or officer code
with 1, 2, 3, ... blanks between officer
and code
. The cell wraps this text if it is small enough. Or it can contain officer\ncode
or officer\n code
or officer \ncode
in any possible combinations. So you should detect at first what content cell A1
actually contains.
从图中不清楚,实际上包含什么内容单元格A1。它被格式化为“自动换行”。所以它可以包含官方代码或官员代码或官方代码,在officerand代码之间有1,2,3,...空格。如果文本足够小,则单元格将其包装。或者它可以包含任何可能的组合中的官员\ n代码或官员\ n代码或官员\ ncode。因此,您应该首先检测A1实际包含的内容单元格。
If it is officer\ncode
:
如果是官员\ ncode:
You really should not have field names containing line feeds with ADO. But if you have you can use an underscore instead of the line feed within the field name.
你真的不应该有包含ADO换行符的字段名称。但是如果你有,你可以在字段名称中使用下划线而不是换行符。
Example:
例:
If the Excel sheet name is staff record
and the column header is
如果Excel工作表名称是人员记录而列标题是
officer
code
where there is a line feed between officer and code,
官员和代码之间有换行的地方,
then the following select should work:
然后以下选择应该工作:
Select [officer_code] from ['staff record$']
The annoying thing with this is that one cannot see in the view whether there are not even more weird things. For example if there is a space after officer
before the line feed, then it is [officer _code]
.
令人烦恼的是,在视图中看不到是否有更奇怪的东西。例如,如果在换行之前有一个空格后的空格,那么它是[官员_code]。
So, you really should not have field names containing line feeds.
所以,你真的不应该有包含换行符的字段名称。