Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
urbanforum
Starting Member
1 Post |
Posted - 2014-02-24 : 23:08:02
|
Hi All,I'll be transparent from the start here, I'm a VoIP guy and I have a requirement from my customer that requires checking a value in a table and files in a folder. The customer wants this in a SSIS package, no exceptions. I really assumed that there would be a "IF" task in the toolbox, but I assumed wrong. All I'm trying to do is simply check if a particular query returns a result or not: SELECT CallStatusZone1 FROM DL_5010_5010 WHERE CallStatusZone1 = 'P'So if the result is P, to me it's true and I want the logic to go through some sort of true branch. If I don't get the result of 'P', I want to send the logic to another "IF" task that will check for the same query, except instead of 'P', it'll be 'C'. If I 'C' is returned, then I'm going to check a particular folder to see if a file exists.At this point, I can't seem to get past the first part. I've spent several days banging my head against the wall watching youtube videos and reading tutorials - either I'm stupid or I just don't understand the SQL world I'm on SQL 2008 R2Thx |
|
kennejd
Starting Member
11 Posts |
Posted - 2014-02-26 : 15:03:19
|
You're correct...there is no 'IF ELSE' object in the SSIS toolbox...at least none that I'm aware of on the control flow. However, what I've done is use the Precedence Constraint to apply a condition. The Precedence Constraint is the (normally) green line that is connected between the objects. To apply a constraint, you will need to create an execute sql task with a single row result set at the point you want to test. Then double-click the green line and change the evaluation option to Expression and Constraint. You might want to google this for an example....probably easier than trying to follow my instructions...:) |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2014-02-27 : 02:41:16
|
quote: Originally posted by urbanforum Hi All,I'll be transparent from the start here, I'm a VoIP guy and I have a requirement from my customer that requires checking a value in a table and files in a folder. The customer wants this in a SSIS package, no exceptions. I really assumed that there would be a "IF" task in the toolbox, but I assumed wrong. All I'm trying to do is simply check if a particular query returns a result or not: SELECT CallStatusZone1 FROM DL_5010_5010 WHERE CallStatusZone1 = 'P'So if the result is P, to me it's true and I want the logic to go through some sort of true branch. If I don't get the result of 'P', I want to send the logic to another "IF" task that will check for the same query, except instead of 'P', it'll be 'C'. If I 'C' is returned, then I'm going to check a particular folder to see if a file exists.At this point, I can't seem to get past the first part. I've spent several days banging my head against the wall watching youtube videos and reading tutorials - either I'm stupid or I just don't understand the SQL world I'm on SQL 2008 R2Thx
see how to do this herehttps://www.simple-talk.com/sql/ssis/working-with-precedence-constraints-in-sql-server-integration-services/------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
|
|
|
|
|
|
|