Home > Archive > MS SQL Server DTS > March 2006 > Conditional email









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Conditional email
Doug

2006-03-17, 8:24 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.

Darren Green

2006-03-17, 8:24 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@discussions.microsoft.com> wrote in message
news:340EA0B6-0F3D-4D73-BE95- 1A72E584564D@microso
ft.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
> want to fire an email. How do I make the email conditional on the results
> of
> the query?
>
> Thanks in advance.
>



Doug

2006-03-19, 11:09 am

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@discussions.microsoft.com> wrote in message
> news:340EA0B6-0F3D-4D73-BE95- 1A72E584564D@microso
ft.com...
>
>
>

Darren Green

2006-03-21, 3:31 am

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@discussions.microsoft.com> wrote in message
news:0BD713FC-B690-478E-8106- B2B330B0B9BC@microso
ft.com...[color=darkred]
> 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:
>


Doug

2006-03-23, 1:31 pm

Working great. Thank you for your help.

"Darren Green" wrote:

> 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@discussions.microsoft.com> wrote in message
> news:0BD713FC-B690-478E-8106- B2B330B0B9BC@microso
ft.com...
>
>
>

Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com