SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Select * from openrowset returns Null values
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

infodemers
Posting Yak Master

Canada
181 Posts

Posted - 10/09/2012 :  11:55:05  Show Profile  Reply with Quote
Hi,
When I run the following, columns F10, F11 and F12 have Null values while data is present in the Excel file.

SELECT F1,F2,F3,F4,F5,F6,F7,F8,F9,F10,F11,F12,'' AS [Date Upload]
FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0','Excel 8.0;Database=\\blmcik\BWAsset\BW_GWC.xls;IMEX=1;HDR=YES', 'SELECT * FROM [Report 1$]')
WHERE [F1] <> 'Clli Code'


I also try the following with same results:
SELECT F1,F2,F3,F4,F5,F6,F7,F8,F9,F10,F11,F12,'' AS [Date Upload]
FROM OPENROWSET('Microsoft.ACE.OLEDB.12.0',
     'EXCEL 12.0;Database=\\blmcik\BWAsset\BW_GWC.xls;
     HDR=YES;IMEX=1','SELECT * FROM [Report 1$]')
WHERE [F1] <> 'Clli Code'


Any Idea?
Thanks!

infodemers
Posting Yak Master

Canada
181 Posts

Posted - 10/09/2012 :  12:17:52  Show Profile  Reply with Quote
I found out.
I changed the cells format to text for those 3 columns in the Excel files and everything worked fine now!
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000