Article ID: 189683 - View products that this article applies to.
This article was previously published under Q189683
This article has been archived. It is offered "as is" and will no longer be updated.
ADO allows you to query a table based solely on its name. If just a table name is specified, ADO prepends select * from and executes that query. If the table you want to query is an Access table with a space in its name, you need to place square brackets around the table's name.
If you want to query the Order Details table in the Access Northwind (NWind.MDB) database that ships with many products using ADO, you need to use code like the following:
You can also use the back quote if you need to use the table name with spaces. For example:
NOTE: You can only use the back quote in Access. A standard quote will not work.
This information also applies when using the ADO Data Control that ships with Visual Basic 6.0.
SQL Server 7.0 does support columns names with spaces.
In ISQL ( aka query analyzer) you can use select [ff cc] from table1
table1 -------- table name ff cc -------- column name char(10)-------- column type
If you execute the statement
insert will occur via insert into table1([ff cc]) VALUES('xx')
You can use
set quoted_identifier on
You can create a table that have column names with spaces like:
select 'ff cc' from table1
A standard quote will not work. Back quotes do not currently work with back end as SQL Server 7.0.
create table table1([col1 xx] integer)
Article ID: 189683 - Last Review: February 21, 2014 - Revision: 1.3