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)
 Openrowset returns null values from excel

Author  Topic 

dpais
Yak Posting Veteran

60 Posts

Posted - 2010-04-13 : 11:17:55
i have a text field in Excel and a value in it that is cut and pasted from a numeric field.

when i query the excel file with OpenRowSet i get null values ..... even though the data is present in the spreadsheet and it is text format.

if i then open the spreadsheet and doubleclick in the cell and then come out of it .... therefore not changing the cell in anyway but just going in and out, then exist and save the spreadsheet .... then when i run the open rowset the values show up...

i'm confused why is this ?? ... the openrowset code follows .... please help

select [f2],[f103], [f104], [f105] FROM
OPENROWSET
( 'Microsoft.Jet.OLEDB.4.0',
'Excel 8.0;DATABASE=C:\Import\test.xls',
'Select * from [Item$]'
)

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-04-15 : 08:54:16
Did you format the ceel to numeric and try the code?

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -