Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default EXCEL AND OLEDB

Hello

I have a spreadsheet I am trying to Query as follow and it works

"SELECT [Product ID] FROM Sheet1$

But for some odd reason productIDs that are only numeric displays as blanks whereas non numeric productIDs do display

So I tried a different query

"SELECT CAST([Product ID] AS VARCHAR(25)) FROM Sheet1$

But I got an error message. How far can I take TSQL to query a spreadsheet

Yama
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default EXCEL AND OLEDB

It makes a determination on the data type in the first couple of cells, I
believe, then once determined, only selects cells that match that type.

--
Regards,
Tom Ogilvy

"Yama" wrote in message
...
Hello,

I have a spreadsheet I am trying to Query as follow and it works:

"SELECT [Product ID] FROM Sheet1$"

But for some odd reason productIDs that are only numeric displays as

blanks whereas non numeric productIDs do display.

So I tried a different query:

"SELECT CAST([Product ID] AS VARCHAR(25)) FROM Sheet1$"

But I got an error message. How far can I take TSQL to query a

spreadsheet?

Yama



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default EXCEL AND OLEDB

Hello Tom,

That's the obvious deduction! :-)
How to SELECT every cell in a specific format. In SQL I can either use a CAST or a CONVERT. How about in EXCEL Query language?

Yama

----- Tom Ogilvy wrote: -----

It makes a determination on the data type in the first couple of cells, I
believe, then once determined, only selects cells that match that type.

--
Regards,
Tom Ogilvy

"Yama" wrote in message
...
Hello,
I have a spreadsheet I am trying to Query as follow and it works:
"SELECT [Product ID] FROM Sheet1$"
But for some odd reason productIDs that are only numeric displays as

blanks whereas non numeric productIDs do display.
So I tried a different query:
"SELECT CAST([Product ID] AS VARCHAR(25)) FROM Sheet1$"
But I got an error message. How far can I take TSQL to query a

spreadsheet?
Yama




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 459
Default EXCEL AND OLEDB

"Jake Marx" wrote in message ...

I don't think you can force Excel to grab all data without using a
workaround. The ODBC driver scans the first 8 rows of data in each column
to determine the data type.


The quoted 8 rows is a registry setting:

Hkey_Local_Machine/Software/Microsoft/Jet/4.0/Engines/Excel/TypeGuessRows

Setting the value to 0 (zero) should force ADO to scan all column
values before choosing the appropriate data type.

--
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 860
Default EXCEL AND OLEDB

onedaywhen wrote:
"Jake Marx" wrote in message
...

I don't think you can force Excel to grab all data without using a
workaround. The ODBC driver scans the first 8 rows of data in each
column to determine the data type.


The quoted 8 rows is a registry setting:

Hkey_Local_Machine/Software/Microsoft/Jet/4.0/Engines/Excel/TypeGuessRows

Setting the value to 0 (zero) should force ADO to scan all column
values before choosing the appropriate data type.


Right - and point #2 in my post and the second KB article referred to this
workaround.

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]

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
Missing OLEDB drivers in Excel 2000 (9.0.28.12) Missing OLEDB drivers Blank OLAP Provide Excel Discussion (Misc queries) 1 March 12th 09 09:42 PM
OleDB Provider for Excel 2007 Binary (.xlsb) Rafael Excel Discussion (Misc queries) 1 December 19th 08 05:57 PM
Using OleDB to get data from Excel dvd00 Excel Discussion (Misc queries) 1 November 30th 04 04:32 PM
Query OLEDB Provider for Excel file info? mike Excel Programming 5 January 15th 04 12:33 PM
Excel schema using Jet OLEDB Provider? mike Excel Programming 1 December 22nd 03 09:25 AM


All times are GMT +1. The time now is 05:45 AM.

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

About Us

"It's about Microsoft Excel"