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 2008 Forums
 SSIS and Import/Export (2008)
 keeping track during for each loop

Author  Topic 

ravensensei
Starting Member

13 Posts

Posted - 2010-03-04 : 15:25:28
I'd like to write something somewhere to keep track of things during a for each loop I'm running. I'd then like to take that info and email it to a mailbox for people to check to make sure things have run, and if not, where they failed.

possible?

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-03-05 : 10:31:16
keep track of each iteration values you mean?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

ravensensei
Starting Member

13 Posts

Posted - 2010-03-05 : 10:50:49
yeah for the most part. Like if I am reading from a database and tacking a value onto my sql insert each time. That variable changes each time and I'd like to email a success/failure list when the forloop finishes.

87 - success
102 - failure
88 - success
etc.

the number signifies the db I'm reading from. And on that note, how can I continue a for each loop on failure. Is that a setting in the foreach loop I"m missing?
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-03-05 : 11:43:25
you can add a send mail task inside and send mail based on status

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

ravensensei
Starting Member

13 Posts

Posted - 2010-03-05 : 11:50:03
that makes sense, but what if there are 47 times the loop runs? Isn't there an easier way to just write to a file or a db table and then send one email?

Don't get me wrong, I'm going to try this, maybe only send on failure tho.

Will For Each loop keep running if there is a failure?
Go to Top of Page
   

- Advertisement -