Import data from Excel file into SQL Server - sql

i am trying to import data from an EXCEL file into SQL SERVER. When i run this query
SELECT * INTO EXCEL_IMPORT
FROM OPENROWSET('Microsoft.ACE.OLEDB.12.0','Excel 12.0; Database=C:\Users\af\Desktop\Reports\Jan_2016_Ships.xlsx; HDR=YES; IMEX=1',
'SELECT * FROM [Sheet1$]');
I get this error
The OLE DB provider "Microsoft.ACE.OLEDB.12.0" has not been registered.
So i needed to install this driver but after doing some searches i found this :
Install Microsoft.ACE.OLEDB.12.0 driver
To import Excel 2007-2016 files to SQL Server Microsoft.ACE.OLEDB.12.0
driver should be installed.
To download the driver use the following link:
Microsoft Access Database Engine 2010 Redistributable
Don't worry about "Access" in the name.
Warning! x64 driver can not be installed if Microsoft Office 2007-2016
x86 is already installed!
So there is no way to import Excel data to SQL Server x64 using
OPENROWSET/OPENDATASOURCE functions on a machine with Microsoft Office
x86!
So i couldn't install this driver because i have SQL SERVER x64 and Microsoft Office x86. I don't want to use the simple import wizard because i have many tables and i need to check the data type of the columns... it will be time consuming in my case.
I believe there should be a solution to run my query on SQL SERVER x64 and Microsoft Office x86.
Any suggestions please ? Thank you very much

Best way of Import/Export data into Sql Server is Import/Export Wizard facility in SQL Server .
Please refer below link .
http://searchsqlserver.techtarget.com/feature/The-SQL-Server-Import-and-Export-Wizard-how-to-guide
Thanks .

If you run it only once you may can run the query in a SSIS package and change the solution to 32bit-mode (right-click the solution, properties, debugging, run64bitRuntime = false)

Is microsoft excel installed in your system?.
this might solve your problem.
Also you can import to a table manually by SQL management studio.
right Click on database > Tasks > Import Data

It looks like you are mixing 32-bit drivers with 64-bit drivers. This is a big nono. These two resources are probably your best place to start.
http://www.cnblogs.com/anorthwolf/archive/2012/04/25/2470250.html
http://www.excel-sql-server.com/excel-sql-server-import-export-using-vba.htm

Related

how to import an excel file use the 64 bit version import export wizard

I'm using SSMS v18.9 and am trying to import excel file (excel for microsoft 365 MSO(16.3.13801) 64bit.
I get the following error: "The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine."
I've read way to many articles and it always says to run the 64 bit import/export wizard. I think I've tried them all to no avail. I downloaded visual studio and the necessary extensions, opened a ssis project and ran the import/export wizard from there and got the same result.
Any help on this is much appreciated.
Hi This issue is due to the PC doesn't have Excel read drivers. Please download and install
Microsoft Access Database Engine 2010 Redistributable
or try this below choose 64 or 32 bit according to you PC.
Download and install Microsoft 365 Access Runtime
Are there any particular reason that you need to use 64 bit? if not follow these steps switch between 32 and 64 bit

I need the ODBC SQL driver 17.2.01 MSI

I need to upgrade Microsoft SQL Server Management Studio 17 (AKA ssms) or perhaps just the ODBC SQL driver because when I try to open a DB from copied datafiles (mdf and ldf) that came from another machine it cannot be opened because it is version 869. And my machine apparently supports version 852 and earlier.
If I want to sideload the latest ssms 18.4, I can't upgrade because it needs to remove that version. There's a pop-up that it needs 'Microsoft ODBC Driver 17 for SQL server' (that needs a msodbcsql.msi file).
So I need the msi of that specific version, could anyone provide this for me because I can't find it anywhere online. :-(
I even ran the FixMissingMSI tool that scans your system for missing msi's:
https://github.com/suyouquan/SQLSetupTools
I ran into similar problem today. Performed uninstall of ODBC 17 driver using following tool from Microsoft,
https://support.microsoft.com/en-nz/help/17588/windows-fix-problems-that-block-programs-being-installed-or-removed
After doing this SSMS setup was successful.

SQL Server Import and Export Wizard: Data destination issue

I am trying to get familiar with SQL Server commands and procedures. So I have downloaded from my university's Dreamspark account the Visual Studio 2015 Enterprise Edition.
My idea (call it personal project) was to try and import an excel table with dimensions 34162x465. And then within Visual Studio to try and manipulate it. For that reason I downloaded the SSDT for Visual Studio 2015 in order to use the SQL Server Import and Export Wizard.
I successfully researched and solved the first shortcoming, which was a Microsoft.ACE.OLEDB.12.0 problem.
But then, after I chose the excel file as a source, and when I reached the next step, to pick a destination, I chose SQL Server Native Client 11.0. The problem is that I cannot assign a SQL server because the drop down list is empty.
**I have already set up a local server (C:) and a database in Visual Studio's SQL environment, but I have no idea why the Wizard cannot detect its name.
Apologies if the question sounds ambiguous or I have missed any crucial details. Also, I have searched in various forums and online for similar issues but I couldn't find a solution.

Converting Access Database to MSSQL Database Using Microsoft SQL Server Migration Assistant for Access

I am trying to convent a Ms Access Database to MS SQL 2012, using Microsoft SQL Server Migration Assistant for Access version 6.0
but each time i try to convert it an error pops up. any ideas how i can solve the problem i reinstall the program Microsoft SQL Server Migration Assistant for Access , and it worked just ones and after that i have the same error.
any help will be most appreciated
Access Object Collector error: Database
Retrieving the COM class factory for component with CLSID {CD7791B9-43FD-42C5-AE42-8DD2811F0419} failed due to the following
error: 80040154 Class not registered (Exception from HRESULT:
0x80040154 (REGDB_E_CLASSNOTREG)). This error may be a result of
running SSMA as 64-bit application while having only 32-bit
connectivity components installed or vice versa. You can run 32-bit
SSMA application if you have 32-bit connectivity components or 64-bit
SSMA application if you have 64-bit connectivity components, shortcut
to both 32-bit and 64-bit SSMA can be found under the Programs menu.
You can also consider updating your connectivity components from
http://go.microsoft.com/fwlink/?LinkId=197502.
An error occurred while loading database content.
Just to complete the other side of the story...
If you have a 64-bit setup, you might have to go the other direction
and install the 64-bit MSAccess 2010 engine.
I'm running Access 2013, and I believe it is 64-bit.
But the SMAA tool threw the 80040154 error.
I think SMAA can't or doesn't use the 64-bit connectivity drivers that come with 64-bit Access 2013.
So using the 32-bit SMAA didn't help.
Installing the 64-bit 2010 engine did.
I got it as a free standalone download here:
https://www.microsoft.com/en-us/download/details.aspx?id=13255
After the quick install of this, I simply started
SMAA 64-bit again,
and the wizard was successful the first time.
thanks to :
https://social.technet.microsoft.com/Forums/itmanagement/en-US/0249eebf-14bd-45f6-9bca-3b42395a3d13/ssma-60-error-retrieving-the-com-class-factory-for-component-failed-due-to-the-following-error?forum=sqlservermigration
I remember this error. I had to find the EXE for 32-bit SSMA even though I was running 64-bit windows. The default installed location was:
C:\Microsoft SQL Server Migration Assistant for Access\bin
And the filename was:
SSMAforAccess32.exe
[SOLVED]
I encountered the same error while using SSMA v7.7.0 for migrating from MS-Access 2016 DB to SQL Server 2017. Fortunately, I got it fixed by installing Microsoft Access Database Engine 2016 Redistributable
with regards to installing the runtime environment of Access to get around the 80040154 error from SSMA: With Access 2016, I found that the runtime environment would not install because I already had Access installed. I needed to deinstall Access, then install the runtime only version. Then, SSMA would run without the 80040154 error. Total pain tho.
If you're trying to read/write data from/to MS Access database file via .NET application, try to switch the project to x86 architecture. It helps in my case

Unnable to connect TSQLConnection to SQL Server

When I try to connect a TSQLConnection with MSSQLConnection it returns dbxmss.dll missing.
There is no such dll in all of my C: drive (I checked also ...\bin\ folder)
I've already uninstalled and reinstalled Delphi (XE4).
And, after that, it is still missing.
The table was created with Microsoft SQL Server 2012 (v11.0.3128.0) Management Studio.
Am I doing something wrong?
It appears you're using a Professional or lower SKU of RAD Studio. The lower editions don't come with drivers for SQL Server or Oracle for DBExpress.
You'll need to switch to using ADO (via the components in the dbGo component palette page), upgrade to a higher SKU (Enterprise or Architect), or find a third-party dbExpress driver to use instead.
Download Zip folder
Extract libmysql.dll, Place it in the folder "C:\Program Files (x86)\Embarcadero\RAD Studio\9.0\bin64