I am trying to read data from excel file from SQL query and insert it in temp table but not able to read the data from Excel file. Getting Below Errors:
Below Solutions Tried:
SELECT * FROM OPENROWSET(
'Microsoft.ACE.OLEDB.12.0',
'Excel 8.0;HDR=NO;Database=T:\temp\Test.xlsx',
'select * from [sheet1$]')
SELECT * FROM OPENDATASOURCE('Microsoft.ACE.OLEDB.12.0', 'Data Source=C:\Users\Downloads\Excel Logic File.xlsx;Extended Properties=EXCEL 12.0')..[Sheet1$];
Also Tried Executing below before running the query:
EXEC sp_configure 'show advanced options', 1
RECONFIGURE
GO
EXEC sp_configure 'ad hoc distributed queries', 1
RECONFIGURE
GO
Getting the error( Linked servers are not supported in this version of SQL Server.) EXEC ('select * from table') at linkedserver
'OPENROWSET' rowset provider not supported in this version of SQL Server.
As mentioned in MSDoc OPENDATASOURCE
and OPENROWSET
are supported in Azure SQL Database but the data file must be in Azure Blob Storage to use the BULK option.
Create external data source and upload sample excel file in Azure Blob Storage. Add the required file formats(Please check the following sample)
CREATE EXTERNAL DATA SOURCE mydata
WITH (
TYPE = BLOB_STORAGE,
LOCATION = 'https://blb1209.blob.core.windows.net'
);
SELECT * FROM OPENROWSET(
BULK 'data/sample3.csv',
DATA_SOURCE = 'mydata',
SINGLE_CLOB) AS DataFile;
From On-Premise
Able to Import the Data from Excel using Tasks => Import Data
Check the below workaround.
We can Import Excel Data to Azur SQL using many ways.
Right click on your DB => Tasks => Import Data Select the DataSource as Excel = > Browse your Excel file
Select Destination as Microsoft OLEDB Provider for SQL Server => Enter credentials for SQL Server Authentication
Output in On-prem:
Output in Azure SQL
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.