SQL Server Management Objects (SMO) Reference in Excel 2010 VBA Project? - excel

Using Excel 2010 using VBA, I would like to be able to start/stop and view running SQL Server jobs, create new tables for import jobs, as well as run backups and other administrative tasks on my local SQL Server. I would also like to use it as a front end for reports for my imported data.
I am trying to locate a reference to SQL SMO but do not see it in Excel Tools -> References. It is installed, I have verified that.
My development environment is:
Windows 7 64-bit
SQL Server 2008 R2 64-bit
MS Office Premium 2010 32-bit
I am aware that this could be done a dozen other ways but I have been trying to get it to work in Excel for days and searching on this combination of programming has yielded nothing except how to do this with SQL DMO (the former object model) which I do not have installed as its deprecated in SQL Server 2008 I understand.
I also tried a direct reference to the Microsoft.SqlServer.Smo.dll file located at C:\Program Files\Microsoft SQL Server\100\SDK\Assemblies which failed with a Cant add a reference to the specified file. error.
Is it possible to gain access to SQL SMO via VBA in Excel or am I out of luck and should move to VB.net / C# etc?

After much research I have found out that it is not possible to consume what is essentially a dot-net, 64-bit, resource from a 32-bit Excel program. I would have to install the 64-bit version of office and give that a try. Perhaps in a VM I shall try.

Related

How to connect Excel to Oracle with PowerQuery

I am trying to connect Excel to my company's Oracle Database. According to the following instructions it should be fairly easy: https://www.wikihow.com/Connect-Excel-to-an-Oracle-Database.
However it has been impossible and quite frustrating so far.
I have followed two different approaches that I've found online.
FIRST APPROACH: installed ODAC from Oracle's Universal Installer
I went to this site https://www.oracle.com/database/technologies/dotnet-odacdev-downloads.html and downloaded the ODAC 12.2.0.1.1 file.
Then, I went through the installation process basically just clicking 'next' on every step.
Note 1: (I don't know if this might be important), in the Database Connection configuration tab I did not fill in any of the information (simply because I didn't know what to put there). It said that if information wasn't filled in, it would not create the TNSNAMES.ORA file.
Note 2: After finishing the installation it says 'run the SQL scripts located in the ... directory after the install'. Which I didn't do, again, because I didn't know how.
After the installation finished a directory was created in the following location: C:\app\client\myUserName\.
The directory goes all the way down to C:\app\client\myUserName\product\12.2.0\client_1, and it contains a bunch of files and folders.
I noticed that no environmental variable was created.
SECOND APPROACH: installed ODBC instant client
I went to this site https://www.oracle.com/database/technologies/instant-client/winx64-64-downloads.html and downloaded both instantclient-basic-windows.x64-19.6.0.0.0dbru.zip and instantclient-odbc-windows.x64-19.6.0.0.0dbru.zip.
Then I created the directory C:\Oracle\instantclient_19_6 and unziped both folders contents into it.
Finally, I ran odbc_install from the command_line, as an administrator, but got Oracle ODBC Driver with same name already exists.
Note: in this case I also noticed that no environmental variable was created.
RESULTS:
When I go to Excel and click on Data\From Database\From Oracle Database I keep getting the same error as before: The recommended provider ('Oracle.DataAccess.Client') is not installed. You can continue with your current provider, however it has been deprecated and may not work properly.".
I was able to solve it by installing the 64 bits version of Oracle's client. Its located at https://www.oracle.com/database/technologies/112010-win64soft.html, file win64_11gR2_client.zip.
Although the message "The recommended provider ('Oracle.DataAccess.Client') is not installed. You can continue with your current provider, however it has been deprecated and may not work properly." remained, I was able to connect after ignoring it.
I have also tried a bunch of approaches and finally got rid of the 'Oracle.DataAccess.Client is not installed' error.
Install Oracle Client for Microsoft Tools:
ODP.NET, Oracle Developer Tools for Visual Studio (Code), and ODAC
https://www.oracle.com/database/technologies/net-downloads.html
Oracle Client for Microsoft Tools installs and configures ODP.NET to support 64-bit Microsoft tool connections with Oracle database. It supports connecting with Power BI Desktop, Power BI service, Excel, SQL Server Analysis Services, SQL Server Data Tools, SQL Server Integration Services, SQL Server Reporting Services, and BizTalk Server.
I have installed Oracle Client for Microsoft Tools 19.17 for (Microsoft Windows x64 (64-bit)) (V1032890-01.exe).
Alternatively, you could follow the learn more link:
Connect Microsoft Tools to Oracle Databases
https://www.oracle.com/database/technologies/appdev/ocmt.html
Tutorials > Power BI Desktop: Connect to Oracle Database
https://www.oracle.com/a/ocom/docs/database/microsoft-powerbi-connection-adw.pdf

Is it actually possible to create SSIS packages in a 64-bit environment that use Excel 2007 sources and destinations?

Windows 10 Pro 64-bit (Version 1903)
Sql Server 2019.
VS 2010.
MS Office 2016 64-bit.
Moving a legacy SSIS package from an older 64-bit environment.
Unable to create an Excel Source or Destination in VS. When attempting Excel 2007, then VS complains that ACE.OLEDB is not registered. When attempting Excel 97, VS complains about JET. The messages have not changed either before or after installing Access Database Engine end Microsoft Access Runtime 2010. Beginning to wonder if this is supported at all.

ssis 2015 excel Could not retrieve the table information for the connection manager ‘Excel Connection Manager’

we've got a Windows Server 2012 R2 with SSIS 2015 installed, and also SAP BO BI 4.2. There is also Office 2016, and we first tried (and then uninstalled) Microsoft Office Access Redistributable 2010 32bit (which had some problems with BO), and then we successfully installed Microsoft Office Access Redistributable 2016 32bit.
Before the redistributable, the SSIS couldn't even see the Excel component in the data flow. We are accessing with some users in RD to the machine, and there is a user which is administrator.
So, the administrator made all the install/uninstall. If we open a SSIS solution with the administrator, and we open a DTSX with an Excel connection, it hangs. If we try to make a new SSIS to point to a new Excel, when we try to open the table we get "Could not retrieve the table information for the connection manager ‘Excel Connection Manager’". That also happens to some of my collegues.
What is extremely strange, is that this doesn't happen to my user. I can connect to the RD, open the SSIS solution, and all the metadata is loaded. I can create a new DTSX, point to the same Excel on the server, and I see the sheets to choose. Somehow, I guess, my user is the only one which is loading correctly the dlls for Access 2016 (if I try to set a different driver, it doesn't load).
I'll try when I get back to work to see if the suggestion here to read from SQL and see if I get the same error from the other users is always the same...but still I need to get why my user is working.
https://mariussqlbi.wordpress.com/2013/09/06/extracting-data-from-excel-with-ssis/
Any help would be appreciated...
Daniele

SSIS and 64bit excel

I have researched this thoroughly but I've yet to find a satisfactory answer.
I am using SQL Server Data Tools 2010 and Microsoft Office 2013 64-bit. I know that there is a compatibility problem and I am trying to solve it because I know for a fact that you can use an .xlsx file as a data source in a Data Flow.
First I tried setting Run64BitRuntime to False in Project -> Properties -> Configuration Properties - > Debugging but it didn't work
Whenever I try importing an .xlsx file I get the same error
Microsoft Visual Studio
------------------------------
Could not retrieve the table information for the connection manager
'Source Path'. Failed to connect to the source using the connection
manager 'Source Path'
------------------------------
So I tried downloading the "Microsoft Access database engine 2010" as so many suggested. The 64-bit installed successfully but the 32-bit returned the following error
You cannot install the 32-bit version of Microsoft Access database engine 2010
because you currently have 64-bit Office products installed.
Now I know I am missing a step here cause while I can see "Microsoft Access database engine 2010" in the list of installed programs in control panel it does not show up as an option in the Provider list when I am trying to create a new Connection Manager.
So before I result following the instruction on this blog I would like to ensure there is no easier way of solving the problem
Thank you in advance for you time.
If you're machine is x64, forget about Excel, as there is no driver available.
Just convert the file to CSV and use a Flat File Connector instead.
Ok, the answer was so ridiculously easy that I kind of feel ashamed for this post now.
If you are using Microsoft Office 2013 64-bit and want to work with SSIS you have to download and install the 32-bit Microsoft Access Database Engine 2010 Redistributable, not the 64-bit, set Run64BitRuntime to False and everything will work like a charm.

SSIS 2008 and Excel Interop assemblies

Have an SSIS 2008 package that runs just fine on my local dev machine with Office 2007 installed. It has a script task with interop.excel as a reference. (I'm reformatting some excel sheets with it)
So everything works like a champ until I install and run it on my test SQL 2008 (Server 2008 64bit) server. I install to SSIS, execute it via a SQL Server Job, it runs though most of the steps but then throws an exception when it gets to the script task that needs the excel interop assembly.
I've installed the 2007 PIA and have execution marked as 32bit as well. At this point I'm just kind of lost. Any help is appreciated.
This script task - Is it a .NET script task or a 32-bit script task?
I'm guessing from the interop.excel reference, that its a .NET script task calling out to an old 32-bit library? Can you confirm?
If there is a 32-bit component that you are running on your Win64 environment then you need to be careful about what you are using to register it. By default, regsvr32 is the 64-bit version, so you need to use the regsvr32.exe under c:\windows\systemWOW64 (or something similar). This will ensure the dll is registered in the 32-bit hive of the registry, and available to the WOW (windows-on-windows) emulation environment.
SpreadsheetGear for .NET is an Excel compatible spreadsheet component for 32 bit and 64 bit .NET, and has an API which is similar to Excel's COM API.
You can see some live ASP.NET samples here and download the free trial here.
Disclaimer: I own SpreadsheetGear LLC
I installed Office 2007 on the server I was using. That fixed one problem. Then I discovered another problem that was alleviated by this SO Link

Resources