![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
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. |
#3
| |||
| |||
|
|
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. |
#4
| |||
| |||
|
|
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. |
#5
| |||
| |||
|
|
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. |
![]() |
| Thread Tools | |
| Display Modes | |
| |