Solved

SSIS SQL Server 2014 Data Flow's Applied Logic

Posted on 2016-08-09
3
132 Views
Last Modified: 2016-08-13
I have a SSIS 2014 Package created in Visual Studio 2013. I have successfully performed a simple Data Flow from one table to another. I am now wondering how to apply additional logic: 1. Check for Existence of data, then either update or insert new data into a table's column, and 2. Avoid data duplication. Any help on coding C# or T-SQL for this small, modest task would be greatly appreciated. Thank you.
0
Comment
Question by:ladesigner2014
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 16

Accepted Solution

by:
DcpKing earned 500 total points
ID: 41754868
I assume here that you have already defined the criteria for Record Duplication.
To determine whether you have data to work with in the first place you can place a RowCounter component between the Source and Destination in your data flow. You will need to define an integer variable for this, and provide that variable to the RowCounter component (edit it).
After the flow completes your variable will be set to the number of records transferred. You can use the value of the variable to determine where to go next in Control Flow by having two blue ("on completion") lines from your Data Flow task. Right click them and change their properties and you should be able to edit them to have a condition, such as "User::intNrRecs > 0" for one and "User::intNrRecs != 0" for the other

For the "update or insert" operation you will be performing what is known as an "upsert" ! There are two ways of doing this with SSIS, and there's articles on each by Reza Rad linked to from here that you might find useful (I'm giving a link because they're several pages long!). The explanations are long, but the techniques aren't difficult.

Hope this helps

Mike
0
 

Author Closing Comment

by:ladesigner2014
ID: 41754910
This helped a lot! Thank you!
0
 
LVL 16

Expert Comment

by:DcpKing
ID: 41755035
Hi ladesigner2014
Thanks very much for answering and confirming. Very often points are awarded, but the original author never says much about how things turned out. It's great to hear that I could help you - hopefully we here at EE can help with your next problem too!

Mike
0

Featured Post

How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question