[dba-SQLServer] DTS Conditional email

Ron Allen chizotz at mchsi.com
Thu Sep 28 15:15:38 CDT 2006


I have to do something similar. In my case, I store the number of rows 
returned in a global variable, then I use an ActiveX script in DTS to branch 
execution based on the value. Here is the JavaScript I use:

function Main()
{
	if (DTSGlobalVariables("RecordCount").value == 0)
	{
		return(DTSTaskExecResult_Failure);
	}
	else
	{
		return(DTSTaskExecResult_Success);
	}
}

Then I just branch on failure to the steps needed for that, and on success to 
the rest of the DTS package that runs normally.

HTH,

Ron



> Hello all,
> 
> I was able to build a workflow very quickly to run a query, get the
> results, export them into an excel file, then email the file to a
> distribution list.  
> 
> I am stuck on how to make it do this only when the query returns rows.
> The reason for this to be conditional, is that this only happens when a
> process does not complete of which then needs to throw a flag to certain
> people to check into the issue.  
> 
> Any help would be greatly appreciated.
> 
> Rich
> CONFIDENTIALITY NOTICE: The information contained in this transmission may be 
> confidential or privileged, and is intended solely for the entity or individual 
> to whom it is addressed. If you are not the intended recipient, please be 
> advised that any use, copying, disclosure, dissemination or distribution is 
> strictly prohibited. If you received this transmission in error, please contact 
> the sender at TIGG Corporation immediately by replying to this email and 
> deleting it from your computer.
> _______________________________________________
> dba-SQLServer mailing list
> dba-SQLServer at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/dba-sqlserver
> http://www.databaseadvisors.com
> 



More information about the dba-SQLServer mailing list