Prisoner ZERO
Prisoner ZERO

Reputation: 14166

Importing Excel into SQL Server database

The SQL Data Import Wizard doesn't allow me to change the column types in the "Edit Mappings" option...so I started going down the road of "write a query" for the data transfer.

I got some examples online & enabled 'ad hoc queries' on my machine. However, I keep getting the following exception:

OLE DB provider "MSDASQL" for linked server "(null)" returned message "[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified".

Msg 7303, Level 16, State 1, Line 8 Cannot initialize the data source object of OLE DB provider "MSDASQL" for linked server "(null)".

Q: Did I enable the wrong attribute option?
Q: Is my query wrong?

QUERY:

SELECT * FROM OPENROWSET('MSDASQL',
                         'DRIVER=Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb);
                          UID=admin;
                          UserCommitSync=Yes;
                          Threads=3;
                          SafeTransactions=0;
                          ReadOnly=1;
                          PageTimeout=5;
                          MaxScanRows=8;
                          MaxBufferSize=2048;
                          FIL=excel 12.0;
                          DriverId=1046;
                          DefaultDir=C:\Temp;
                          DBQ=C:\Temp\DataMigration.xls', 
                         'SELECT * FROM [AK$]')

SQL to RECONFIGURE SERVER:
This worked fine...just thought I would include it anyway.

EXEC sp_configure 'show advanced options', 1
RECONFIGURE
GO

EXEC sp_configure 'ad hoc distributed queries', 1
RECONFIGURE
GO

UPDATES:

Unfortunately, I cannot choose "Edit SQL" either
If there is a way to "enable" this option...that would be fine with me. enter image description here

Upvotes: 2

Views: 376

Answers (0)

Related Questions