dbTalk Databases Forums  

Conditional email

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


Discuss Conditional email in the microsoft.public.sqlserver.dts forum.



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

Default Conditional email - 03-17-2006 , 05:47 PM






I am setting up a dts package that will run a query looking for an error. My
query is simply returning a row count. If the query returns a row count >0 I
want to fire an email. How do I make the email conditional on the results of
the query?

Thanks in advance.


Reply With Quote
  #2  
Old   
Darren Green
 
Posts: n/a

Default Re: Conditional email - 03-17-2006 , 06:11 PM






Store the result in a global variable. Then add a constraint between the SQL
Task and the Email Task. Select the Email Task, right-click and select the
Workflow ActiveX Script.

In the script test the variable and return the execute or do not execute
constant as required.


--
Darren
http://wiki.sqlis.com | http://www.sqlis.com | http://www.sqldts.com

"Doug" <Doug (AT) discussions (DOT) microsoft.com> wrote

Quote:
I am setting up a dts package that will run a query looking for an error.
My
query is simply returning a row count. If the query returns a row count
0 I
want to fire an email. How do I make the email conditional on the results
of
the query?

Thanks in advance.




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

Default Re: Conditional email - 03-18-2006 , 12:58 PM



Thank you for the advise. Please excuse my ignorance, but I am very new to
this.

I have defined my global variable (gv_test). What should my activeX script
look like? I have included what I have so far, but it won't work for me.

Thanks in advance.

'************************************************* *********************
' Visual Basic ActiveX Script
'************************************************* ***********************

Function Main()

If gv_test > 0 then
DTSStepScriptResult_ExecuteTask
Elseif gv_test = 0 then
DTSStepScriptResult_DontExecuteTask
EndIF

End Function




"Darren Green" wrote:

Quote:
Store the result in a global variable. Then add a constraint between the SQL
Task and the Email Task. Select the Email Task, right-click and select the
Workflow ActiveX Script.

In the script test the variable and return the execute or do not execute
constant as required.


--
Darren
http://wiki.sqlis.com | http://www.sqlis.com | http://www.sqldts.com

"Doug" <Doug (AT) discussions (DOT) microsoft.com> wrote in message
news:340EA0B6-0F3D-4D73-BE95-1A72E584564D (AT) microsoft (DOT) com...
I am setting up a dts package that will run a query looking for an error.
My
query is simply returning a row count. If the query returns a row count
0 I
want to fire an email. How do I make the email conditional on the results
of
the query?

Thanks in advance.





Reply With Quote
  #4  
Old   
Darren Green
 
Posts: n/a

Default Re: Conditional email - 03-20-2006 , 02:17 PM



If DTSGlobalVariables("gv_test").Value > 0 Then
Main = DTSStepScriptResult_ExecuteTask
Else
Main = DTSStepScriptResult_DontExecuteTask
End If

Note, this is a workflow script not an ActiveX Script Task.

A similar example-

How can I check if a file exists?
(http://www.sqldts.com/default.aspx?211)


--
Darren
http://wiki.sqlis.com | http://www.sqlis.com | http://www.sqldts.com

"Doug" <Doug (AT) discussions (DOT) microsoft.com> wrote

Quote:
Thank you for the advise. Please excuse my ignorance, but I am very new
to
this.

I have defined my global variable (gv_test). What should my activeX
script
look like? I have included what I have so far, but it won't work for me.

Thanks in advance.

'************************************************* *********************
' Visual Basic ActiveX Script
'************************************************* ***********************

Function Main()

If gv_test > 0 then
DTSStepScriptResult_ExecuteTask
Elseif gv_test = 0 then
DTSStepScriptResult_DontExecuteTask
EndIF

End Function




"Darren Green" wrote:

Store the result in a global variable. Then add a constraint between the
SQL
Task and the Email Task. Select the Email Task, right-click and select
the
Workflow ActiveX Script.

In the script test the variable and return the execute or do not execute
constant as required.


--
Darren
http://wiki.sqlis.com | http://www.sqlis.com | http://www.sqldts.com

"Doug" <Doug (AT) discussions (DOT) microsoft.com> wrote in message
news:340EA0B6-0F3D-4D73-BE95-1A72E584564D (AT) microsoft (DOT) com...
I am setting up a dts package that will run a query looking for an
error.
My
query is simply returning a row count. If the query returns a row
count
0 I
want to fire an email. How do I make the email conditional on the
results
of
the query?

Thanks in advance.







Reply With Quote
  #5  
Old   
Doug
 
Posts: n/a

Default Re: Conditional email - 03-23-2006 , 08:57 AM



Working great. Thank you for your help.

"Darren Green" wrote:

Quote:
If DTSGlobalVariables("gv_test").Value > 0 Then
Main = DTSStepScriptResult_ExecuteTask
Else
Main = DTSStepScriptResult_DontExecuteTask
End If

Note, this is a workflow script not an ActiveX Script Task.

A similar example-

How can I check if a file exists?
(http://www.sqldts.com/default.aspx?211)


--
Darren
http://wiki.sqlis.com | http://www.sqlis.com | http://www.sqldts.com

"Doug" <Doug (AT) discussions (DOT) microsoft.com> wrote in message
news:0BD713FC-B690-478E-8106-B2B330B0B9BC (AT) microsoft (DOT) com...
Thank you for the advise. Please excuse my ignorance, but I am very new
to
this.

I have defined my global variable (gv_test). What should my activeX
script
look like? I have included what I have so far, but it won't work for me.

Thanks in advance.

'************************************************* *********************
' Visual Basic ActiveX Script
'************************************************* ***********************

Function Main()

If gv_test > 0 then
DTSStepScriptResult_ExecuteTask
Elseif gv_test = 0 then
DTSStepScriptResult_DontExecuteTask
EndIF

End Function




"Darren Green" wrote:

Store the result in a global variable. Then add a constraint between the
SQL
Task and the Email Task. Select the Email Task, right-click and select
the
Workflow ActiveX Script.

In the script test the variable and return the execute or do not execute
constant as required.


--
Darren
http://wiki.sqlis.com | http://www.sqlis.com | http://www.sqldts.com

"Doug" <Doug (AT) discussions (DOT) microsoft.com> wrote in message
news:340EA0B6-0F3D-4D73-BE95-1A72E584564D (AT) microsoft (DOT) com...
I am setting up a dts package that will run a query looking for an
error.
My
query is simply returning a row count. If the query returns a row
count
0 I
want to fire an email. How do I make the email conditional on the
results
of
the query?

Thanks in advance.








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.