I am trying to upload .xlsx into SQL database table using OLE DB provider "Microsoft.ACE.OLEDB.12.0"
but it throws the following Error:
Error
'Cannot initialize the data source object of OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "(null)". OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "(null)" returned message "Cannot update. Database or object is read-only.".'
my sql code is:
'ALTER PROCEDURE [dbo].[spx_ImportFromExcel07]
@SheetName varchar(20),
@FilePath varchar(100),
@HDR varchar(3),
@TableName varchar(50)
AS
BEGIN
DECLARE @SQL nvarchar(1000)
IF OBJECT_ID (@TableName,'U') IS NOT NULL
SET @SQL = 'INSERT INTO ' + @TableName + ' SELECT [Dealer Number],[Dealer Name],[Policy Number],[Policy Status],[Processing Date (ISO)],
[Policy Start Date (ISO)],[Request Cancel/ Amend Date],[Amend/Cancel Type],[Cancel/Amend Text],[Chassis Number],[Registration Number],
[Manufacturer Desc],[Model Desc],[Transmission Desc],[Fuel Type Desc],[Registration Date (ISO) L],[Product Description],
[User Id],[Customer Full Name],[Sub Total],[Tax],[Customer Charge],null,null,null,null FROM OPENDATASOURCE'
ELSE
SET @SQL = 'SELECT * INTO ' + @TableName + ' FROM OPENDATASOURCE'
SET @SQL = @SQL + '(''Microsoft.ACE.OLEDB.12.0'',''Data Source='
SET @SQL = @SQL + @FilePath + ';Extended Properties=''''Excel 12.0;HDR='
SET @SQL = @SQL + @HDR + ''''''')...['
SET @SQL = @SQL + @SheetName + ']'
EXEC sp_executesql @SQL
END'
after try this steps http://www.excel-sql-server.com/
Error is
'The OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "(null)" does not contain the table "Sheet1$". The table either does not exist or the current user does not have permissions on that table.'