dbTalk Databases Forums  

Question on If Statement in DTS Package

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss Question on If Statement in DTS Package in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
kennethgrice@yahoo.com
 
Posts: n/a

Default Question on If Statement in DTS Package - 11-18-2005 , 06:23 PM






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.


Reply With Quote
  #2  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: Question on If Statement in DTS Package - 11-19-2005 , 06:24 AM






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


"kennethgrice (AT) yahoo (DOT) com" <kennethgrice (AT) yahoo (DOT) com> wrote


Quote:
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.


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.