dbTalk Databases Forums  

How to conditionally send email task?

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


Discuss How to conditionally send email task? in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
thabrown
 
Posts: n/a

Default How to conditionally send email task? - 05-15-2006 , 01:02 PM






Hello,
I have created a SSIS package that loads a SQL 2005 table with data from an
Excel Source. Error (row redirect) outputted to an flat file. I have added
a Send mail task to the control flow, but cannot figure out how to
conditionally cause it to execute when the data flow actually outputs rows to
the error output. In the Contraint Editor between the Data Flow task and
Send Mail task, I have set the contraint option to evaluate an expression
@error_happened = true. @error_happened is a variable I defined but cannot
figure out how to set within the data flow -- logically it should be set when
the data flow outputs data to the error flat file.

Any advise much appreciated.

Thank you,

Thomas

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

Default Re: How to conditionally send email task? - 05-15-2006 , 01:26 PM






Hello thabrown,

Ok So here's an idea.

In the pipeline add a row number transform. This will count any redirected
rows.

In the control flow you have an expression on the constraint to the Send
Mail Task that does something like

@CountOfRedirectedRows > 0

is the name of your variable.


Allan


Quote:
Hello,
I have created a SSIS package that loads a SQL 2005 table with data
from an
Excel Source. Error (row redirect) outputted to an flat file. I have
added
a Send mail task to the control flow, but cannot figure out how to
conditionally cause it to execute when the data flow actually outputs
rows to
the error output. In the Contraint Editor between the Data Flow task
and
Send Mail task, I have set the contraint option to evaluate an
expression
@error_happened = true. @error_happened is a variable I defined but
cannot
figure out how to set within the data flow -- logically it should be
set when
the data flow outputs data to the error flat file.
Any advise much appreciated.

Thank you,

Thomas




Reply With Quote
  #3  
Old   
thabrown
 
Posts: n/a

Default Re: How to conditionally send email task? - 05-15-2006 , 03:59 PM



Thanks, Allan!
That was a simple solution. I even added the rowcount variable to my email
message.
I appreciate your quick response and help.

Although this solves this particular issue, I'd be interested to hear about
other examples people may have of email tasks in SSIS packages that send
detailed error information. Any event handlers examples, for instance?

Thank you,

Thomas

"Allan Mitchell" wrote:

Quote:
Hello thabrown,

Ok So here's an idea.

In the pipeline add a row number transform. This will count any redirected
rows.

In the control flow you have an expression on the constraint to the Send
Mail Task that does something like

@CountOfRedirectedRows > 0

is the name of your variable.


Allan


Hello,
I have created a SSIS package that loads a SQL 2005 table with data
from an
Excel Source. Error (row redirect) outputted to an flat file. I have
added
a Send mail task to the control flow, but cannot figure out how to
conditionally cause it to execute when the data flow actually outputs
rows to
the error output. In the Contraint Editor between the Data Flow task
and
Send Mail task, I have set the contraint option to evaluate an
expression
@error_happened = true. @error_happened is a variable I defined but
cannot
figure out how to set within the data flow -- logically it should be
set when
the data flow outputs data to the error flat file.
Any advise much appreciated.

Thank you,

Thomas





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

Default Re: How to conditionally send email task? - 05-15-2006 , 04:36 PM



Hello thabrown,


I build the message up for the eMail through property expressions. I take
a mix of variables I have used in the workflow that are user defined and
a few of the system variables. I find this works. If you place mails in
the EHs then you get goodies like ErrorDescription etc.

Allan


Allan Mitchell
www.SQLDTS.com
www.SQLIS.com
www.Konesans.com

Quote:
Thanks, Allan!
That was a simple solution. I even added the rowcount variable to my
email
message.
I appreciate your quick response and help.
Although this solves this particular issue, I'd be interested to hear
about other examples people may have of email tasks in SSIS packages
that send detailed error information. Any event handlers examples,
for instance?

Thank you,

Thomas

"Allan Mitchell" wrote:

Hello thabrown,

Ok So here's an idea.

In the pipeline add a row number transform. This will count any
redirected rows.

In the control flow you have an expression on the constraint to the
Send Mail Task that does something like

@CountOfRedirectedRows > 0

is the name of your variable.

Allan

Hello,
I have created a SSIS package that loads a SQL 2005 table with data
from an
Excel Source. Error (row redirect) outputted to an flat file. I
have
added
a Send mail task to the control flow, but cannot figure out how to
conditionally cause it to execute when the data flow actually
outputs
rows to
the error output. In the Contraint Editor between the Data Flow
task
and
Send Mail task, I have set the contraint option to evaluate an
expression
@error_happened = true. @error_happened is a variable I defined but
cannot
figure out how to set within the data flow -- logically it should be
set when
the data flow outputs data to the error flat file.
Any advise much appreciated.
Thank you,

Thomas




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.