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.

 All Forums
 SQL Server 2005 Forums
 SSIS and Import/Export (2005)
 Constraint Failure not Failing

Author  Topic 

Trudye
Posting Yak Master

169 Posts

Posted - 2009-02-25 : 11:09:14
I previously posted this in the wrong Forum

I need a qry that will give me a negative/failure result when there are not records in a table. I can’t get my pkg to fail and exec my Failure Constraint, here is what I wrote. I doesn't have to look like this I just need it to fail when there are no records on Import_2

select count(Orig) as NoAG from Import_2
Where Orig In ('A', 'G')

Any ideas how I can get this puppy to fail?

Thank much,
Trudye

vijayisonly
Master Smack Fu Yak Hacker

1836 Posts

Posted - 2009-02-25 : 11:20:19
Set the count to a variable...and use a conditional split on that variable to set your success or failure paths.

select case when count(orig) > 0 then 'SUCCESS' else 'FAILURE' end from Import_2
Where Orig In ('A', 'G').

You can set this to a variable and 'SUCCESS' will be ur success path...'FAILURE' will be your failure path.
Go to Top of Page

Trudye
Posting Yak Master

169 Posts

Posted - 2009-02-26 : 15:00:12
Thank you so much for responding. I figured out what I was doing wrong I was not putting a Constraint on the recs exist leg.

It seems to work great now.

Thanks again,
Trudye
Go to Top of Page
   

- Advertisement -