Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How to use OLEDB and Reserved Chars

All,

I have used OLEDB to gather the data out of Excel using
simple queries such as select * from [Sheet1$]; However,
if my excel sheet has a name like "Test Sheet" or my
columns have titles like "Test.Column", it gets returned
to my dataset with a table name 'Test Sheet' (displaying
the single quotes) and a column name as Test#Column .

How can I fix this, or is there even a fix for it?

Thanks,

Tyler
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 593
Default How to use OLEDB and Reserved Chars

"Tyler Davey" wrote ...

I have used OLEDB to gather the data out of Excel using
simple queries such as select * from [Sheet1$]; However,
if my excel sheet has a name like "Test Sheet" or my
columns have titles like "Test.Column", it gets returned
to my dataset with a table name 'Test Sheet' (displaying
the single quotes) and a column name as Test#Column .


Have you tried aliasing them e.g.

SELECT
[Test#Column] AS [Test Column]
FROM
['Test Sheet$'] AS [Test Sheet]
;

Jamie.

--
  #3   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default How to use OLEDB and Reserved Chars

Cannot do it that way as I don't know what the column
names are ahead of time. Has to be dynamic.

Thanks though,

Tyler
-----Original Message-----
"Tyler Davey" wrote ...

I have used OLEDB to gather the data out of Excel

using
simple queries such as select * from [Sheet1$];

However,
if my excel sheet has a name like "Test Sheet" or my
columns have titles like "Test.Column", it gets

returned
to my dataset with a table name 'Test Sheet'

(displaying
the single quotes) and a column name as Test#Column .


Have you tried aliasing them e.g.

SELECT
[Test#Column] AS [Test Column]
FROM
['Test Sheet$'] AS [Test Sheet]
;

Jamie.

--
.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 593
Default How to use OLEDB and Reserved Chars

wrote ...

SELECT
[Test#Column] AS [Test Column]
FROM
['Test Sheet$'] AS [Test Sheet]
;


Cannot do it that way as I don't know what the column
names are ahead of time. Has to be dynamic.


Are you using ADO? If so, you can use the OpenSchema method to get the
names of the Excel tables their columns. You can use this information
to construct a select query using appropriate aliases you require.
This is what is done for you under the covers anyhow when you use

SELECT * FROM ...

except *you* would be in control of the aliasing.

Otherwise, if your app need to be *that* dynamic them you must take
whatever you get.

Jamie.

--
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to truncate list of meaningful words greater than 15 chars tomeaningful words of 8 chars. Babloo Excel Worksheet Functions 4 April 29th 11 11:27 PM
Microsoft.ACE.OLEDB.12.0 - BUG Sven Pran Excel Discussion (Misc queries) 0 July 8th 08 06:42 PM
What is a 'reserved name' and how do I get rid of it? crusoe Excel Discussion (Misc queries) 3 February 16th 07 03:54 AM
Bug in OLEDB ? Ric[_4_] Excel Programming 4 June 8th 04 11:45 AM
EXCEL AND OLEDB Yama Excel Programming 4 February 25th 04 03:29 PM


All times are GMT +1. The time now is 02:55 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"