Stored Procedure on SQL Server 2017 calls an OPENROWSET command to load a file from an .xlsx file.
When running the Stored Procedure on the server it works fine and will load the xlsx rows into data tables. However when the SSIS package runs the Execute T-SQL Statement task to EXEC the same stored procedure it gives me this error:
"[Execute SQL Task] Error: Executing the query "EXEC USP NAME" failed
with the following 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 "Unspecified error".". Possible failure reasons:
Problems with the query, "ResultSet" property not set correctly,
parameters not set correctly, or connection not established
correctly."
The connection being used in the package has full access to the folder that contains the xlsx file and the Test Connection works just fine.
Related
Getting the below intermittent error, when inserting the records in Oracle DB using a stored procedure in SQL via linked server.
The OLE DB provider "OraOLEDB.Oracle" for linked server "linkedServer" supplied inconsistent metadata. An extra column was supplied during execution that was not found at compile time.
When I re-run the stored procedure with same arguments again and its successful.
When developing SSIS package using VS 2005, I set up the connection manager for oledb teradata provider and added a oledb source and destination. For oledb source, I used the data access mode as sql command and added sql command text. But when I tried to do column mapping, I'm getting an error message which is detailed below.
Error at All Transactions [OLEDB Source [1627]]:
An OLEDB error has occurred. Error code: 0x80040E21.
An OLE DB record is available. Source: "OLE DB Provider for Teradata" Hresult:
0x80040E21 Description: "Multiple-step OLE DB operation generated errors. Check
each OLE DB status value, if available. No work was done.".
ADDITIONAL INFORMATION:
Exception from HRESULT: 0xC0202009 (Microsoft.SqlServer.DTSPipelineWrap)
BUTTONS:
OK
Please let me know why such error throws. I have a workaround which is described as follows.
when you store the sql within ( and ) and alias the query and set the data access mode as table name or view name variable, then it works fine.
Without any more information on the SQL being used in the OLEDB Source component, I can try and guess. Maybe the issue is with the SQL that is returning columns with the same name or similar situation that leads to incorrect metadata.
I just got this error and I simply edited the provider to a different provider, tested, and then set it back to the original provider. In my case I was using OLEDB Native client 11 so I set it to 10 and then back to 11.
My guess is the XML got corrupted somehow as my package has been working forever.
I tried to move data aka ETL from one sql server to another as mentioned in a previous question - Copy data from one column into another column. Now, I get an error when I try to execute a query.
Query -
INSERT INTO [Target_server].[Target_DB1].[dbo].[Target_Table1](Target_Column1)
SELECT Source_Column222
FROM [Source_server].[Source_DB1].[dbo].[Source_Table1]
WHERE Source_Column1 = 'ID7162'
Error -
OLE DB provider "SQLNCLI" for linked server "MYLINKEDSERVER" returned message "Unspecified error".
OLE DB provider "SQLNCLI" for linked server "MYLINKEDSERVER" returned message "The stored procedure required to complete this operation could not be found on the server. Please contact your system administrator.".
Msg 7311, Level 16, State 2, Line 1
Cannot obtain the schema rowset "DBSCHEMA_TABLES_INFO" for OLE DB provider "SQLNCLI" for linked server "MYLINKEDSERVER". The provider supports the interface, but returns a failure code when it is used.
If your wrote that simple select is not working, the issue is in security configuration of the linked server and permissions which your user receive there.
Among this, when you execution your query, you don't need to specify the server name and DB name for both parts - source and target. You simply need to execute the query on target server and target database. In this case your query instead of
INSERT INTO [Target_server].[Target_DB1].[dbo].[Target_Table1](Target_Column1)
SELECT Source_Column222
FROM [Source_server].[Source_DB1].[dbo].[Source_Table1]
WHERE Source_Column1 = 'ID7162'
will looks like the following:
INSERT INTO [dbo].[Target_Table1](Target_Column1)
SELECT Source_Column222
FROM [Source_server].[Source_DB1].[dbo].[Source_Table1]
WHERE Source_Column1 = 'ID7162'
and you need your connection to be opened on server [Target_server] and database [Target_DB1]. Also the linked server security properties need to be checked on [Target_server] against the [Source_server].
If you are using loop back linked server (linked server refering to the same database in the same server) then refer the below mentioned link:
Transaction with loopback linked server - locking issues
If that is not the case, this is the solution provided by Microsoft.
In SSIS (SQL Server 2008 R2), I'm using an OLE DB Command to repeatedly execute a procedure. The procedure is located on server A and calls server B. How do I let the OLE DB Command know how to access server B? (I can't move the procedure to server B.)
Step-by-step:
In the "Advanced Editor for OLE DB Command"->"Connection Managers" tab, I select server A.
In the "Advanced Editor for OLE DB Command"->"Component Properties" tab, I type "Exec myProc ?"
The "Column Mappings" gives an error: "Syntax error, permission violation, or other nonspecific error".
Thank you for the responses!
I was looking for a "Linked Server". It took me awhile to find it because in SQL Server Management Studio it's not under the database, but under the server itself in the "Server Objects" folder.
Once I made this in Management Studio the SSIS package could call the procedure without an issue.
I am trying to import data from DBF file to SQL table using the following command -
select *
from openrowset('MSDASQL',
'Driver={Microsoft dBase Driver (*.dbf)};DBQ=E:\data\;',
'select * from E:\data\a.dbf')
But it is failing saying
OLE DB provider "MSDASQL" for linked server "(null)" returned message "[Microsoft][ODBC dBase Driver]General Warning Unable to open registry key 'Temporary (volatile) Jet DSN for process 0x120 Thread 0x3084 DBC 0x303dfbc Xbase'.".
OLE DB provider "MSDASQL" for linked server "(null)" returned message "[Microsoft][ODBC dBase Driver] Disk or network error.".
Msg 7303, Level 16, State 1, Line 1
Cannot initialize the data source object of OLE DB provider "MSDASQL" for linked server "(null)".
Any clue why it is giving error? For the second error I have given full access to temp folder as suggested by some blog. Still it is showing both error.
If filename is a .dbf
Try this:
select * from
openrowset('MSDASQL',
'Driver={Microsoft dBASE Driver (*.dbf)};DriverID=277;Dbq=E:\Data;',
'SELECT * FROM a')
Your SELECT is specifying the path to the file - you should be specifying the table name instead, which is presumably 'a'.
To supplement CodeByMoonlight, the Driver information points to the path the data file is found, so then your subsequent query should only be "Select * should from a" since both the path and the .dbf extension should be implied
You are using 64-bit SQL Server which is looking to the 64-bit ODBC sources when the drivers are 32-bit. There is a workaround for FoxPro (also DBF) that should work for dBASE as well:
Open a new SqlDataSource in Visual Studio using the .NET Framework Provider for OLE DB then MS OLE DB Provider for VFP. The connection string should look like this (or with UNC)
Provider=VFPOLEDB.1;Data Source=h:\Programs\Data;Persist Security Info=True;User ID=Your_user;Password=your_password
The config wizard includes a part to test your SQL. You can use this run ad hoc SQL.