Question

I'm trying to read data from an Excel spreadsheet into SQL, but for some reason some of fields are showing as NULL even though the spreadsheet has data in that particular column/row (in this instance it's a number).

All of the other column/rows that have text show up OK.

This is the query I am using

select * from 
OPENROWSET ('Microsoft.Jet.OLEDB.4.0', 'Excel 8.0;Database=G:\XLS\ACK.xls', [ACK$])

I'm using SQL server management studio 2005 to run the query.

Any ideas/suggestions as to why this is happening? Thanks.

Was it helpful?

Solution

looks like if i use CSV instead of XLS then i get all the data intact

select *
from OpenRowset('MSDASQL', 'Driver={Microsoft Text Driver (*.txt; *.csv)}; DefaultDir=G:\xls\;Extensions=CSV;',
'select * from ack2.csv')
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top