January 11, 2017 at 4:16 am
Hello,
I've just been asked to prepare a query and generate it into an .xlsx file. There are numerous hints on how to do the SQL using T-SQL or Powershell.
Here are some few examples:
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=49926
http://microsoft-ssis.blogspot.co.uk/2014/02/connecting-to-excel-xlsx-in-ssis.html
What I cannot find is how to verify that my SQL-Server has the right components installed. I can only see from the "Programs and Features" that MS Office is installed (I uploaded a screenshot). Is there any way I can verify that I can generate an .xlsx file? Which version of Microsoft.ACE.OLEDB should I use against a 64-bit SQL Server 2012 version?
Bare in mind I haven't got a clue about things like "OLE DB Provider for Jet", what the differences are, etc.
If this is the code that has to be used:
insert into OPENROWSET('Microsoft.Jet.OLEDB.4.0',
'Excel 8.0;Database=D:\testing.xls;',
'SELECT * FROM [SheetName$]') select * from SQLServerTable
then what is the correct version to generate an .xsls format? Am I correct in thinking the code above is to generate .xls, not .xlsx?
Thanks
Richard
January 11, 2017 at 4:52 am
To export from SQL Server to Excel, you'll need to use the ACE 32bit drivers (The JET drivers are the older drivers and are no longer supported).
It's the Microsoft Access Database Engine 2010 Redistributable drivers that you need. AS above, ensure you download the 32bit (x86) file, NOT the 64bit.
This will also enable you to perform tasks using SSIS to export or import data to similar files.
hopefully this will get you on the right path 🙂
Thom~
Excuse my typos and sometimes awful grammar. My fingers work faster than my brain does.
Larnu.uk
January 11, 2017 at 6:19 am
If you output your data as tab delimited to an .xls (not .xlsx) file
Excel will be able open the file if you accept the prompts (depending on version of Excel)
Far away is close at hand in the images of elsewhere.
Anon.
January 11, 2017 at 7:28 am
Thanks, the problem is this is an index file that goes to a 3rd party to load data into our web site, so it must be automated, hence without any prompting. I suspect the web program will not be reading the .XLSX as a spreadsheet, rather as a text file. I asked my colleagues about this, why they want to generate .xlsx instead of .csv.
January 11, 2017 at 7:30 am
Thom A (1/11/2017)
To export from SQL Server to Excel, you'll need to use the ACE 32bit drivers (The JET drivers are the older drivers and are no longer supported).It's the Microsoft Access Database Engine 2010 Redistributable drivers that you need. AS above, ensure you download the 32bit (x86) file, NOT the 64bit.
This will also enable you to perform tasks using SSIS to export or import data to similar files.
hopefully this will get you on the right path 🙂
Thanks, but are you sure? MS Access Drivers onto a SQL Server 2012 installation? Pretty odd solution from MS.
January 11, 2017 at 7:36 am
richlion2 (1/11/2017)
Thom A (1/11/2017)
To export from SQL Server to Excel, you'll need to use the ACE 32bit drivers (The JET drivers are the older drivers and are no longer supported).It's the Microsoft Access Database Engine 2010 Redistributable drivers that you need. AS above, ensure you download the 32bit (x86) file, NOT the 64bit.
This will also enable you to perform tasks using SSIS to export or import data to similar files.
hopefully this will get you on the right path 🙂
Thanks, but are you sure? MS Access Drivers onto a SQL Server 2012 installation? Pretty odd solution from MS.
Very sure.
Thom~
Excuse my typos and sometimes awful grammar. My fingers work faster than my brain does.
Larnu.uk
January 11, 2017 at 1:28 pm
why not the 2013 or even the 2016 version of the ACE driver?
2013 - https://www.microsoft.com/en-ie/download/details.aspx?id=39358
2016 - https://www.microsoft.com/en-ie/download/details.aspx?id=50040
You do not need to buy any special product in order to redistribute the Access 2013/6 Runtime. You can freely redistribute it or point users to this download.
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply