SSIS Runs Okay Individual Tasks, Not Together - sql-server

I have a simple SSIS Project. In the control flow I have three steps:
Step 1: Select Data from Db1.Table1
Step 2: Create Table2 in Db2
Step 3: Copy Data in Db1.Table1 to Db2.Table2
If I "Execute Task" one by one in order, it executes fine...but if I try running the entire project I receive the following error:
Error at Copy Data from Table1 to DB2 dbo Table2 Task [OLE DB Destination[40]]: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80040E37.
An OLE DB record is available. Source: "Microsoft OLE DB Provider for SQL Server" Hresult: 0x80040E37 Description: "Invalid object name 'DB2.dbo.Table2".".

The issue was with the validation. On child tasks by default DelayValidation is disabled. Since the second step creates a table which is in the third step populated with the data pulled in the first step, there is a validation error. SSIS looks for the table and it doesn't exist. By enabling DelayValidation it operates fine - since it doesn't force the tables to be in existence before executing.

Your control flow makes no sense to me. There is no reason at all to havea step that only selects records. When this runs as a job who would see it and if you aren;t doing anything with them then why select.
If you are doing no cleanup or transformations why are you even using SSIS? Wouldn;t a t-sql stament of
SElect into table2 from table1 be sufficient? Of course this is problem if running more than once, so I would probably write a script to create the table if is doesn't exist, truncate it is does (I'm assuming you are replacing the data here) and then insert into it.

Related

No column information was returned by the SQL command. SSDT

I'm attempting to create an update query in SSDT. I'm getting
Unable to parse query text.
The query is:
UPDATE CustOrderWithDisp
SET YARDS = CustOrderWithDisp.QUANTITY * Lkp_TestCodes.[Test_GALS] * 0.00495113
FROM CustOrderWithDisp
INNER JOIN Lkp_TestCodes
ON CustOrderWithDisp.TEST_CODE = Lkp_TestCodes.[SVC CODE]
But if I actually run the query, it works.
I want to use this query in an SSIS package. When I put this query in an OLEDB Source, i get...
The component reported the following warnings:
Error at qry03_CalculateYards [OLE DB Source [33]]: No column information was returned by the SQL command.
I'm a novice at this, so be gentle. Your help is greatly appreciated!
Error at qry03_CalculateYards [OLE DB Source [33]]: No column information was returned by the SQL command.
You are receiving this message because OLEDB Source is a DataFlow Task component, it is used to read data from an Table or SQL Command through an OLEDB Connection.
The OLE DB source extracts data from a variety of OLE DB-compliant relational databases by using a database table, a view, or an SQL command. For example, the OLE DB source can extract data from tables in Microsoft Office Access or SQL Server databases.
You don't have to put this query in an OLEDB Source, you have to use an Execute SQL Task and write this query in the SQL Command property.
For UPDATE queries you have to use Execute SQL Task (in the Control Flow level, no in the DataFlow)
The Execute SQL task runs SQL statements or stored procedures from a package. The task can contain either a single SQL statement or multiple SQL statements that run sequentially.
References
Execute SQL Task
OLEDB Source

ssis control flow execute sql vs data flow sql command

I have a stored procedure(sp_selectClient) having a cursor which is performing some insert operations in every iteration. In last statement of sp I selected the result from a table.
Now I am creating a ssis package and I am new in this. I found the simplest way by adding Data Flow Task in Control Flow and then inside Data Flow I added one source(OLEDB) in which I set the SQL Command 'EXEC sp_selectClient'. The stored procedure do not accept any parameters. And then I mapped it into destination(flat file). My query is can I do this with Execute SQL Task also. If yes then what are the advantages and disadvantage of doing this.
Yes you can do the same with Execute SQL task also.
OLE DB Command inside data flow task: Will always process the data row by row
Execute SQL task in control flow: will process the data in bulk
What is the difference between Execute SQL Task and OLE DB Command
If your Stored procedure create a result set, you can do this using Execute SQL Task and storing the Resultsets inside a variable of type Object Then looping over rows inside a Script Task.
These are usefuls links that helps you to store ResultSets inside a variable and loop over its rows inside a Script Task:
How to loop through a generic object in SSIS Script Task
Implementing Foreach Looping Logic in SSIS
Execute SQL Task
If your stored procedure does not produce any ResultSets (Select command) it is best practice to use an Execute SQL Task
The OLE DB Command runs insert, update or delete statements for each row, while the Execute SQL Task does a Bulk Insert in this instance. That means every single row that goes through your package would have an insert statement run when it gets to an OLE DB Command.
References:
SSIS – Avoid OLE DB Command

Loading temporary tables in parallel

I load data from one SQL Server A to temporary table via Execute SQL Task (select * into x from remote_server) and join with another remote SQL Server B in Data flow.
So I have two source in Data Flow:
1.Local temporary table which contains date from SQL Server A (loaded in previous task)
2.Table on remote SQL Server B.
To achieve it I change "RetainSameConnection" connection manager property (which I use it to pull data from SQL Server A to local machine (SSIS server) to TRUE. It works but I cannot load these tasks parallely, because I get:
S [[209]] Error: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error
has occurred. Error code: 0x80040E14. An OLE DB record is available.
Source: "Microsoft SQL Server Native Client 11.0" Hresult: 0x80040E14
Description: "Statement(s) could not be prepared.". An OLE DB record
is available. Source: "Microsoft SQL Server Native Client 11.0"
Hresult: 0x80040E14 Description: "Invalid object name
'##V_DEL'.".
[SSIS.Pipeline] Error: "S" failed validation and returned validation
status "VS_ISBROKEN".
How to solve it?
If you are using RetainConnection = True then only 1 object at a time can have the retained connection. This means that if 2 sql tasks run in parallel then only 1 will use the retained connection. Similar to the issue that you cant have a lookup and a dest with the same retained connection.
The only workaround is to serialize your SQL calls.
Simple solution: Just take Global temp table creation task in one sequence container and insert part in another sequence container. It will work fine and we can run the 2 task in parallel.
Take temp table creation part in one sequence container and insert part in another sequence container and it will work even if we run task in parallel having more than one Global temp tables.

SSIS Connection to ORACLE (Multiple-step OLE DB operation generated errors)

I have an "Native OLE DB\Oracle Provider for OLEDB" connection in SSIS package to execute a procedure on ORACLE.
Procedure is working fine but in log file I am seeing below mentioned warning, which is slowing down the execution.
Warning : Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.
The procedure is having 5 inputs and 2 out paras. After reading few articles which point says it could be due to data type/size mismatch.
I personally think its something to do with connection setting. I created a simple task of deleting data from a table without any para or variable. Still there was a warning
Its simple delete statement.
BEGIN DELETE FROM KC.KC_PAYMENT; END;
The warning appears after "validation is completed". and before the delete statement "Progress" event.
Deepak
There are many ways to work around this problem. What I am thinking as of now is
1) Store the Connection string that points to oracle into sql server table or in variable.
https://www.connectionstrings.com/oracle-provider-for-ole-db-oraoledb/
2) Check for security while fetching the records.
3) Use the "Oracle provider for OLE DB" from SSIS, don't use the "Microsoft Provider for Oracle" because a 64 bit version of it does not exist.
4) Schedule your packages with the SQLAgent.

SSIS: transaction during simultaneous moving of data

I implemented SSIS package which moves data from Sql Server database to another one. This package has set of Data Flow Tasks which copy data simultaneously in different tables. Each Data Flow Task contain OLE DB datasource and Sql Server destination.
Package worked fine until I decided to implement transaction. I found that it is not possible to just set TransactionOption to Supported on package level, because SSIS cannot handle transactions in multiple simultaneous processes. So, I decided to use this way:
http://consultingblogs.emc.com/jamiethomson/archive/2005/08/20/SSIS-Nugget_3A00_-RetainSameConnection-property-of-the-OLE-DB-Connection-Manager.aspx
But now I have another problem. I have "Unable to bulk copy data. You may need to run this package as an administrator" errors. These errors occur in random places. For example if I ran package in the first time Data Flow Task named "Task A" can be executed correctly, but when I run package in the second time it can throw the error.
How do I can implement transaction in my case? (Changing of package in order to perform execution of Data Flow tasks sequentially is not an option)
I got a recent error with our MS SQL Server 2008R2 and SSIS. Found the error:
[SQL Server Destination [16]] Error: Unable to bulk copy data. You may need to run this package as an administrator.
[SSIS.Pipeline] Error: component "SQL Server Destination" (16) failed the pre-execute phase and returned error code 0xC0202071.
but could not solve it with running as Admin. The error only came with one step and I finally found out that I get rid of the error when I increased the timeout of the SQL Server Destination. Funny is that with the read of external ADO NET Source I get a proper error that helped me to see the timeout is the problem.

Resources