all groups > sql server dts > november 2005 >
You're in the

sql server dts

group:

Question on If Statement in DTS Package


Question on If Statement in DTS Package kennethgrice NO[at]SPAM yahoo.com
11/18/2005 4:23:45 PM
sql server dts:
Hello I have a view that will include any records that have the word
fail in a particular field.
Does anybody know what the code would look like to

First check and count how many rows are in the view. (The View name is
Test)
Then, if there is at least one row in the view


I want to go on to the next step. And that is a batch email program.

But if there are zero rows in the view; which means there are no
records with the word fail in a particular field, I don't want the
package to run the batch email program.

Thanks for any help; I have just started using DTS.
Re: Question on If Statement in DTS Package Allan Mitchell
11/19/2005 12:24:13 PM
So you want condtitional execution

ExecuteSQL task

SELECT Count(*) as Amount FROM VIEW

In the parameters area (click on the parameters button) assign "Amount"
to a global variable

Now in an Active Script task you check the value of the variable

If the value = 0 then you disable the following step.

We do that here but with files.

Looping, Importing and Archiving
(http://www.sqldts.com/default.aspx?246)


Allan


[quoted text, click to view]
AddThis Social Bookmark Button