Insert status of SSIS package in SQL Table - sql-server

My project consist of creating multiple sub directories and copy files to those sub directories. I developed this part using file system task inside a foreach loop in SSIS.
The final part is insert into SQL Table, the status of the process. If the file was copy successful the Status column should be "Successful" and the reason in another column should be "File was copied successfully" or something like that.
The error flow redirection (red arrow) is available for file system task or foreach loop? I have read somewhere that in event handlers you can work these status messages and insert them in SQL. Could someone please provide a solution or suggest one to solve this problem?

I would steer away from using event handlers. They are like hidden GOTOs, in which there is no indication in the control flow that they exist and you have to go to another screen to see what they are doing.
It's much more clear to use the control flow to direct errors. Any arrow from any task or container can be double clicked and configured. Change the constraint option to value=Failure to make the arrow go red.

Related

Captiva Designer ODBC - Flow does not error out even if it returns more than one rows

I am working with Captiva Designer and implemented a flow. In the ODBC setup, I have checked the checkbox which says "Error if more than one row found".
I tested the flow and intentionally used a query which would return multiple rows. However the flow picks up the first query and process next steps accordingly.
How can I fix this issue?
For marking it as error, it will not mean to give any batch level error. However it will mention "More than one row found for fetch", in description attribute, in export module at document level.
you can handle the case accordingly in your flow using the above value.

SSIS - capture "ExecutionResult" / "Data Code" in Variable?

It seems SSIS has some unexposed variables called execution_result in the SSISDB/ Catalog under internal.executable_statistics.
But it's also referred to as DataCode in some places but it's essentially for each executable (so task or package level, etc).
0 = success, 1 = failure, 2 = complete, 3 = canceled.
I'm rolling some custom logging just as a simplified/ understandable view of my ETL tasks in SSIS to use in tandem with the more 'kitchen sink' logging in the SSIS Catalog 'internal' schema in SQL Server.
There are no system variables that seem to mimim/ capture ExecutionResult for any particular executable. Is there any way I can capture this and write it to a table or save it in a variable?
I've seen some try to use it in a Script Task that had to reference .dtsx filepath etc --- seems pretty complicated but anyone know an elegant way?
Essentially, I want a logging level (custom written) that is essentially: Package XYZ, blah, blah, blah, blah, executionResult: 1
Again I'm aware this is in executable_statistics, but not how I like it, and I only have SQL Sever 2012 currently so can't customize too much either.
Essentially I want to know if a package ultimately "succeeded" or "failed". Errors are on the right track, but not the same. Since it's possible a package (or container) can have an error and still succeed ultimately.
I suppose I could jerry-rig two separate Execute SQL tasks depending on if a package/ container "succeeded" or "failed" and go from there. Hmm.
ExecutionResult is available when using Event Handlers (on OnExecStatusChanged event handler):
System Variables for Event Handlers
So, on each task you can add an OnExecStatusChanged event handler and the #[System::ExecutionResult] variable will be available.
If you are new to Event handlers you can refer to the following articles:
SSIS Event Handlers Basics
Event Handlers in SSIS
Integration Services (SSIS) Event Handlers
Update 1
You can also benefit from the ExecValueVariable property of each task:
ExecutionValue and ExecValueVariable in SSIS
Have you used the ExecutionValue and ExecValueVariable properties?

executeOfflineCommand skips a command while executing from storage on Android

I have to execute "Start" and "Finish" Commands in the Sequential Order in my program and synchronize everything at the end. So I'm inserting the Offline commands in the order first and assuming they will execute in the same order. I'm using "List" with "Iterator" for this.
Problem here is: Finish Command will be missed execution in some strange scenarios in the middle and "start" commands will execute next to each other and sending all wrong data and mapped it in a wrong way.
As action will get ID when command executes at the server, I'm keeping tempory id's to map the offline commands in storage(localID). Instaead of List if I use anyother collection will this gets any better? It is hard to reproducing this on simulator. Please review both scenarios and advise where can this approaches go wrong. Thanks
I will add the OfflineCommands into the List and save in the Storage. After that user can perform delete delete operation in the App so that I will retrieve the list and remove the commands which got deleted from storage so now I have filtered list.
Don't synchronize.
That's nearly always a mistake in Codename One. Your code deals with the UI so it should be on the EDT and Display.getInstance().isEDT() should be true.
My guess is that one of the commands in the middle uses one of the following invokeAndBlock() derivatives:
addToQueueAndWait
Modal dialogs
Which triggers a second round of synchronization to run.
You can trace that by reproducing the issue and checking which command in the list is specifically there at each time. Then fix that command so it doesn't block in this way.
Another approach to fixing it is to remove the list immediately when you start processing which will prevent a duplicate execution of commands.

how to backup and remove an clearcase activity

I need to remove the code changes of an activity from the child stream, which is shared among two projects. Wanted to remove code changes from Project A but I need to secure not to lose the changes in Project B
Can someone suggest me the possible solution and the next steps to be taken care to get rid of this issue.
See "Reverse Change set of an activity in Clearcase": you can use ccperl cset.pl -undo, or do for each file in an activity a negative or subtractive merge.
In both case, the goal is to create a new activity whose change set will represent the negative image of the existing activity.
You can then do what you want/need with it, like deliver it to another stream where the first activity was already delivered.

Cannot put a SQL Task within a Foreach Loop

I am new to SSIS and I am relying on a book, so this should be an easy question to answer.
I want to import data from all of the text files within a directory. So I create a Foreach container.
The first thing I want to do within the loop is execute a SQL task to drop and create the landing table.
Then I want to load the data into the landing table from the selected text file using a Data Flow task.
Then I want to execute a SQL Task to load the SQL tables from the Landing table and do some calculations.
The problem is that within a Foreach loop, I cannot connect up a SQL Task to a Data Flow task. The message I get is
Cannot create connector. Cannot
connect the executables from different
containers.
So how do I do this?
How about a screen shot? I've used these 2 components in a loop container before with no problem, my guess is the GUI is a little deceptive here.
I know this is an old thread. I wanted to add to it though in case it is helpful to anybody.
In my case, I had the foreach loop container with some FTP Tasks and Script Tasks in it and I still need to add more within this foreach loop. I renamed the foreach loop and then added a new Script Task at the bottom of the flow of the foreach loop container. When I tried to connect the current FTP Task at the end of the flow of the foreach loop container to the new Script Task that I'd added at the bottom, I got the error about "Cannot create connector. Cannot connect the executables from different containers."
So I dragged the current FTP Tasks and Script Tasks outside of the newly renamed foreach loop container (or I suspect I could have cut them and pasted them outside the foreach loop container). I then dragged them all back into the newly renamed foreach loop container. I then connected them all again successfully without getting this error.
So it seems that once you rename a foreach loop container WITHOUT being done completely, when you add a new Task icon to the bottom of the flow of the newly renamed foreach loop container you might or will get the error about not being able to connect from different containers (since I guess the newly renamed foreach loop container is considered to be "different" than the old name of the very same foreach loop container.
I've had a similar problem, where is looked as though both the components were in the for loop. Whereas (similar to rageit's comment) one of the sub-compnents were actually on-top rather than within the foreach loop.
The quick fix was to cut the component, select the foreach loop and paste it in.
It looks like you are trying to connect a Sql Task within a foreach loop to a DataFlow task that is not in the loop. If that is what you are intending, you need to take the connection from the ForEach loop and connect it to the DataFlow. If, however, you want both the SQLTask and the Dataflow to run within the ForEachLoop, you need to put the DataFlow into the ForEach loop and then you will be able to connect the SQLTask to the DataFlow.
None was my case. I just moved it from different container to a new container. I had to recreate the task. There is no property to show you what container is holding the task. Definitely GUI bug. I'm using BI 2008
Solution that solved my problem is cut the component and paste it back. If there is a heirarchy of tasks cut all tasks one by one to delete their connections and paste them back and then connect from the top.

Resources