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)
 Excel OpenRowset Issue

Author  Topic 

Vinnie881
Master Smack Fu Yak Hacker

1231 Posts

Posted - 2009-06-03 : 18:29:25
I have a excel sheet with roughly 10000 records.

In this sheet I have formated the columns as general.

When I open the sheet I see all the values, but for some reason I have about 10 records that have null values in the column when using the openrowset.

In order to resolve I need to open the sheet then go into the cell that is being nulled, double click it, exit out of the cell, then save and it works.

Imex is = to 1 on the open row set as well.

I can not figure out a work around and this is causing some issues. Any ideas on how to pull data in from open row set and resolving this?

here's my code


select *
from
OPENROWSET('Microsoft.Jet.OLEDB.4.0',
'Excel 8.0;DATABASE=C:\XLSIMPORTS\test.xls;HDR=YES;Extended Properties=Excel 8.0;IMEX=1', 'Select * from [Revised$]') a

Thanks


Success is 10% Intelligence, 70% Determination, and 22% Stupidity.
\_/ _/ _/\_/ _/\_/ _/ _/- 881

Vinnie881
Master Smack Fu Yak Hacker

1231 Posts

Posted - 2009-06-04 : 08:39:00
Solution I used was to create another column then use the =text(cell,format) function in excel. I could not find a way to handle with out modifying the excel file itself.


Success is 10% Intelligence, 70% Determination, and 22% Stupidity.
\_/ _/ _/\_/ _/\_/ _/ _/- 881
Go to Top of Page
   

- Advertisement -