July 27, 2012 at 1:27 pm
Hi all,
My sql server automatically updates daily from an excel source. What I have been doing is setup a scheduled import of excel data into a temp table, then under jobs, I use T-SQL to merge update this temp table into the actual table.
It works, but I find it having too many steps. What are some best practices out there?
I have attempted to use the OPENROWSET query, but it gives me this error (if someone can also solve this, it would be great):
Cannot create an instance of OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "(null)" --< this is all, nothing else.
Thanks,
Alan
July 27, 2012 at 2:14 pm
I have seen that error when EXCEL is not installed on the server you are using, or your OPENROWSET command is using the incorrect driver with a relatively new release of EXCEL which uses the "ace" driver.
What version of EXCEL are you attempting to use ?
July 27, 2012 at 2:57 pm
I am using Excel 2010, how should the query be edited?
So..the way I am importing and updating data is correct?
July 27, 2012 at 3:03 pm
Here is the difference in the OPENROWSET command:
The latest version of EXCEL
SELECT * FROM OPENROWSET('Microsoft.ACE.OLEDB.12.0', 'Excel 12.0;Database=d:\dasdgigs.xls',
'SELECT * FROM [dasdgigs$]')
For earlier version of EXCEL
SELECT * FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0','Excel 8.0;Database=C:\Temp\OpenRowSetTest2.xls;HDR=yes', 'SELECT * FROM [Sheet1$a4:c]')
July 27, 2012 at 3:10 pm
Just tried the code you provided, still the same error.
SELECT * FROM OPENROWSET('Microsoft.ACE.OLEDB.12.0', 'Excel 12.0; Database = C:\abc.eeee.xls', 'Select * FROM [Sheet1$]')
Same Error ๐
July 28, 2012 at 12:09 am
Alan Kwan (7/27/2012)
Just tried the code you provided, still the same error.SELECT * FROM OPENROWSET('Microsoft.ACE.OLEDB.12.0', 'Excel 12.0; Database = C:\abc.eeee.xls', 'Select * FROM [Sheet1$]')
Same Error ๐
Try using SSIS then. Its a simple transfer from xls to SQL ๐
~ Lokesh Vij
Link to my Blog Post --> www.SQLPathy.com[/url]
Follow me @Twitter
July 28, 2012 at 1:46 am
1. Install Office 2007/2012 Data Connectivity Components (http://www.microsoft.com/download/en/confirmation.aspx?id=23734)
2. Change the extension of your excel file to .xlsx
3.ย Enable "Ad Hoc Distributed Queries" on the server this is running on
4. Run:ย EXEC master.dbo.sp_MSset_oledb_prop N'Microsoft.ACE.OLEDB.12.0', N'AllowInProcess', 1ย GO
ย
SELECT * FROM OPENROWSET('Microsoft.ACE.OLEDB.12.0','Excel 12.0;Database=C:\DM list1.xlsx;HDR=Yes','SELECT * FROM [Sheet1$] WHERE [Sr No] IS NOT NULL ')
I was receiving the same errors as you, after enabling the "in process" for OLDDB, it works - Let me know how it goes for you.
______________________________________________________________________________Never argue with an idiot; Theyll drag you down to their level and beat you with experience
July 28, 2012 at 2:26 am
Please read the information listed on the following URL, this will help you in achieving your objective.
you can also use SQLSERVERAGENT to schedule the package to execute as per your requirement.
July 28, 2012 at 11:24 am
Lokesh Vij (7/28/2012)
Alan Kwan (7/27/2012)
Just tried the code you provided, still the same error.Try using SSIS then. Its a simple transfer from xls to SQL ๐
not just the best, also the easiest way...
~ demonfox
___________________________________________________________________
Wondering what I would do next , when I am done with this one :ermm:
July 28, 2012 at 11:26 pm
demonfox (7/28/2012)
Lokesh Vij (7/28/2012)
Alan Kwan (7/27/2012)
Just tried the code you provided, still the same error.Try using SSIS then. Its a simple transfer from xls to SQL ๐
not just the best, also the easiest way...
I'm not sure how you can say that. The OPENROWSET command looks pretty easy to me.
--Jeff Moden
Change is inevitable... Change for the better is not.
July 29, 2012 at 12:13 am
OP, have you tried my suggestion?
______________________________________________________________________________Never argue with an idiot; Theyll drag you down to their level and beat you with experience
July 30, 2012 at 12:09 pm
I tried the 4 steps you mentioned, and the error message changed this time.
The 32-bit OLE DB Provider "Microsoft.ACE.OLEDB.12.0" cannot be loaded in-process on a 64-bit SQL Server.
What to do now?
July 30, 2012 at 2:48 pm
Download and use the 64-bit one
______________________________________________________________________________Never argue with an idiot; Theyll drag you down to their level and beat you with experience
August 2, 2012 at 9:58 pm
Any luck?
______________________________________________________________________________Never argue with an idiot; Theyll drag you down to their level and beat you with experience
Viewing 15 posts - 1 through 15 (of 15 total)
You must be logged in to reply to this topic. Login to reply