SSIS OLE DB Source using providers - ssis

I'm using a procedure that uses a table variable to fetch relevant data from my DB, and then returns whatever is stored in that table variable to my data flow.
My OLE DB Source is only designed to run the SQL command EXEC FetchData_prc.
It shows the required columns in the Source Editor, and it also lets me do mapping, preview and all of that.
YET, when running the package, it throws the error: [OLE DB Source [1]] Error: A rowset based on the SQL command was not returned by the OLE DB provider.

You may try to set nocount on on your stored procedure to prevent the server from returning the row count. This could be mistaken by SSIS as the returned result set. See this

Related

SSIS special characters in column name

In SSIS I need to import data from table, that has column names like this N°Projet, PR Réalisé. During set up of OLE DB Source everything is OK. I can run this package from Visual Studio and load data. But when I deploy the project and set up sql server job to run it, I get error.
I can see that query in OLE DB Source has changed.
What I set up:
SELECT
[N°Projet] AS ProjectNumber
,[N°Projet] AS CurrentProjectNumber
,[Projet] AS ProjectName
What I see when I recreate SSIS project from sql catalog
SELECT
[N°Projet] AS ProjectNumber
,[N°Projet] AS CurrentProjectNumber
,[Projet] AS ProjectName
And therefor my query in OLE DB Source is invalid.
Any idea how to fix this issue without changing source table columns?

SSIS - Execute SQL Task > Date conversion issue when passing DateTime variable as parameter

Brief background of the system:
Using an SSIS package to move data from SQL Server to MySQL.
I use an OLE DB connection to connect to SQL Server.
I use an ODBC Unicode connection to connect to MySQL.
Most of the system works, but I am having a date conversion issue when passing an SSIS Variable into an Execute SQL Task. It attempts insert a date into a table on the MySQL database. I get the following error when trying to enter a date of {1/1/2010 12:00:00 AM}.
"[Execute SQL Task] Error: Executing the query "Insert into ETLDate values(?)" failed with the following error: "[MySQL][ODBC 5.3(w) Driver][mysqld-5.7.22-log]Incorrect datetime value: '-10165-58296-9719 16613:13824:2136' for column 'LastETLDate' at row 1". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly."
The date is consistently '-10165-58296-9719 16613:13824:2136' so I know the value is getting passed correctly, it's just converted or encoded differently. Here is my setup for the parameter.
Some final notes:
I've tried all the other date data types for the parameter and I get the same issue.
I've tried with just a direct insert statement using the parameter and not a stored procedure and I get the same issue.
All data flow tasks that move data (which includes dates) from the SQL Server DB to the MySQL database work fine.
If create a similar stored procedure and table on the SQL Server DB (with updated parameter settings for the OLE DB connection) it works fine.
Any one know why the date is getting passed incorrectly or have a work around for this issue?

Exporting XML file from a Stored Procedure using SSIS

have a Stored Procedure which has XML as Output and it shows xml output in SSMS. How should I generate an XML file to a specific location from this Stored Procedure using SSIS. I found a link which suggests using VB and script task to do this.Can this be done without using Script Task ? Also I tried following steps in this link :
How to export from SQL Server to XML
The Package fails at Execute SQL Task itself and gives the error [Execute SQL Task] Error: Executing the query "EXEC USP_PMAXML" failed with the following error: "Could not find stored procedure 'EXEC USP_PMAXML'.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.
Thanks for your time and help.
A) The error you are receiving indicates it cannot find the stored procedure. You will want to verify
the stored procedure exists
The account access the stored procedure has execute permissions for it
The stored procedure exists in the default schema, probably dbo, for the account. {I've seen issues where procedures are created under user schemas [domain\user].USP_PMAXML }
The Connection Manager you are using is pointing the correct server and catalog (database).
B) If you would like to use an out of the box approach and avoid scripting, then remove your Execute SQL Task. Below I show an Execute SQL Task for reproduction purposes. It creates a stored proc that generates XML.
Add a Data Flow Task.
Within the Data Flow Task, add an OLE DB Source.
Configure your OLE DB Source to use the connection manager and the stored procedure we verified is correct from step 1
Assuming there should only be one file generated, add a Derived Column Transformation out of the OLE DB Source and inside of it, define the output file name which I assume is C:\ssisdata\so_xmlExtract.xml. I will further assume you rename the column as FileName. The exact value you would use is "C:\ssisdata\so_xmlExtract.xml" Note the doubling of slashes as we must escape the \ character as well as wrap with double quotes.
At this point, you're ready to use the Export Column Transformation. Examples Export Varbinary(max) column with ssis and
Using SSIS to extract a XML representation of table data to a file

SSIS 2008 mySQL source to SQL 2008

I need to copy data from a remote mySQL database into MSSQL Server 2008 database using SSIS 2008 package. I have some Timestamp fields in the mySQL database giving me problems. When l excluded the Timestamp fields l managed to copy the data nicely. On the OLE DB Destination Input - Input Columns the field which is Timestamp on mySQL database is showing as having data type DT_Bytes.
I am getting the error An OLE DB record is available.
Source: "Microsoft SQL Server Native Client 10.0" Hresult: 0x80040E21 Description: "Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done."
[OLE DB Destination [784]] Error: Cannot create an OLE DB accessor. Verify that the column metadata is valid.
My select statement to the mySQL source has got a select case to handle 0 dates it is like;
SELECT case modified_date when day(modified_date) = 0 then '1990-01-01 00:00:00' else modified _date end as modified from mySQLTableName
The problem is definitely with your data types. Open up your Destination component for editing. Go the mapping tab. Hover over each column mapping, first the source column, then the destination. The tooltip will show you what the data types of each column are. One of them doesn't match.
It's most likely your timestamps field, but it might not be, so I won't speculate.
In any case, to make them match, add a Data Transformation component in between your source and destination, and recast the offending source column to the data type you want for inserting into SQL Server. (If the recasting also causes an error, it'll be a lot more helpful one than this one!)

SSIS Query Parameters for ADO .NET Source

I am trying to retieve data from a MySQL table and insert into a SQL Server table using ADO .NET connections in SQL Server 2008 SSIS. In my data flow task I have an ADO .NET Source which queries the MySQL table (select all invoices) and an ADO .NET Destination which inserts the data in my SQL Server table. Now, I would like to add a parameter in my data source so that I only select the max(invoiceNumber) retrieved from my SQL Server table. I have performed a similar task using "OLE DB Command" but the problem is that I need to query a MySQL database. Any ideas how I can achieve this?
I found that the only way to use parameter with the ADO.NET Data Source is this workaround:
Go to the Flow Control and selenct the Activity Flow containing your ADO.NET source.
In the properties window you can see the ADO.NET source Sql Command
Go to expression and select the properties: [YOU SOURCE NAME].[SqlCommand] and then edit the expression using variables to simulate parameters
Set Data Access Mode in ADO.NET Source to SQL Command and write the query.
You shoudn't have to add a parameter:
select *
from invoices
where invoiceNumber = (select max(invoiceNumber) from invoices)
The above works in SQL Server. I'm assuming that the same query will work in MySQL