Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Hitting the limit with OPENROWSET ?

Author  Topic 

ZenRoe
Starting Member

14 Posts

Posted - 2008-11-24 : 10:34:51
Hi,
I use OPENROWSET to select data from an Excel file having more than 26 columns. Unfortunately OPENROWSET only returns 26 columns. Is this a limitation or is there something I can do about it ?

Thanks !

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-11-24 : 10:39:01
Are you hardwiring 26 column?
Do you use "SELECT *"?

There are many things we must know to give an accurate answer.



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-11-24 : 10:39:42
can you show the code?
Go to Top of Page

ZenRoe
Starting Member

14 Posts

Posted - 2008-11-24 : 11:07:50
The whole thing is built up pretty dynamically. Here's the final string:

SELECT * FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0','Excel 8.0;Database=E:\CTTest\LoadStage\myfile.xls','SELECT * FROM [mysheet$a1:z] ')

Thx: Peter
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-11-24 : 11:10:44
There you go!

'SELECT * FROM [mysheet$a1:z]'

only selects 26 columns...



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-11-24 : 11:11:35
Use 'SELECT * FROM [mysheet$a1:iv]' instead to get 256 columns.



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page
   

- Advertisement -