当表是两个单词时构建SQL查询... [英] Building SQL query when table is two words...

查看:102
本文介绍了当表是两个单词时构建SQL查询...的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试构建一个涉及一个名为All

Students的表的查询。


查询只是


sqlString =" SELECT * FROM All Students"


但我得到FROM子句中的语法错误当我试图运行它。我假设

这是因为我的桌子是两个字。我如何获得Access识别

呢?


谢谢,

凯文

I''m attempting to build a query that involves a table called "All
Students".

The query is simply

sqlString = "SELECT * FROM All Students"

but I get "Syntax error in FROM clause" when I try to run it. I assume
this is because my table is two words. How do I get Access to recognize
it?

Thanks,
Kevin

推荐答案

方括号,即


sqlString =" SELECT * FROM [All Students]"

-

Terry Kreft


< au ****** @ quasika.net>在消息中写道

news:11 ********************** @ g49g2000cwa.googlegr oups.com ...
Square brackets i.e.

sqlString = "SELECT * FROM [All Students]"
--
Terry Kreft

<au******@quasika.net> wrote in message
news:11**********************@g49g2000cwa.googlegr oups.com...
我正在尝试构建一个涉及一个名为All
Students的表的查询。

查询只是简单的

sqlString = SELECT * FROM All Students

但我得到FROM子句中的语法错误当我试图运行它。我认为这是因为我的桌子是两个字。我如何获得Access识别它?

谢谢,
Kevin
I''m attempting to build a query that involves a table called "All
Students".

The query is simply

sqlString = "SELECT * FROM All Students"

but I get "Syntax error in FROM clause" when I try to run it. I assume
this is because my table is two words. How do I get Access to recognize
it?

Thanks,
Kevin



Terry Kreft写道:
Terry Kreft wrote:
方括号,即

sqlString =" SELECT * FROM [All Students]"


IMO良好做法总是在字段/表格周围使用方括号

名称。

< au ***** *@quasika.net>在消息中写道
新闻:11 ********************** @ g49g2000cwa.googlegr oups.com ...
Square brackets i.e.

sqlString = "SELECT * FROM [All Students]"
IMO good practice to always use square brackets around field/tables
names.
<au******@quasika.net> wrote in message
news:11**********************@g49g2000cwa.googlegr oups.com...
我正在尝试构建一个涉及一个名为All
Students的表的查询。

查询只是简单的sqlString =" SELECT *来自所有学生

但我得到FROM子句中的语法错误当我试图运行它。我认为这是因为我的桌子是两个字。我如何获得
识别它的权限?

谢谢,
凯文
I''m attempting to build a query that involves a table called "All
Students".

The query is simply

sqlString = "SELECT * FROM All Students"

but I get "Syntax error in FROM clause" when I try to run it. I
assume this is because my table is two words. How do I get Access to
recognize it?

Thanks,
Kevin




-

问候,


布拉德利


基督徒的回应
http://www.pastornet.net.au/response

我会坚持不懈地建立一个你坚持的命名惯例

to;在我的情况下,这主要是: -

a)不使用表格或字段名称中的空格。

b)坚持在我所负责的所有平台上有效的名称

使用。

c)对于带有下划线分隔符的名称使用小写字母以便于阅读。


如果你的约定涉及使用方括号所有时间都很好

但这不一定是好习惯。

-

Terry Kreft


" Br @ dley" <峰; br ** @ usenet.org>在消息中写道

news:oZ ****************** @ news-server.bigpond.net.au ...
I would hold good practice to be to establish a naming convention you stick
to ; in my case this would mainly be:-
a) not use spaces in table or field names.
b) stick to names which are valid on all the platforms I am liable to
use.
c) use lower case for names with underscore separators for readability.

If your convention involves using square brackets at all times that''s fine
but it isn''t necessarily good practice.
--
Terry Kreft

"Br@dley" <br**@usenet.org> wrote in message
news:oZ******************@news-server.bigpond.net.au...
Terry Kreft写道:
Terry Kreft wrote:
方括号,即

sqlString =" SELECT * FROM [All Students]"
Square brackets i.e.

sqlString = "SELECT * FROM [All Students]"


IMO良好做法总是在字段/表名称周围使用方括号。



IMO good practice to always use square brackets around field/tables names.

< au ****** @ quasika.net>在消息中写道
新闻:11 ********************** @ g49g2000cwa.googlegr oups.com ...
<au******@quasika.net> wrote in message
news:11**********************@g49g2000cwa.googlegr oups.com...
我正在尝试构建一个涉及名为All
Students的表的查询。
< SNIP>谢谢,
凯文
I''m attempting to build a query that involves a table called "All
Students". <SNIP> Thanks,
Kevin



-
问候,

布拉德利

基督徒回复
http://www.pastornet.net.au/response



这篇关于当表是两个单词时构建SQL查询...的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆