#Region "Imports" Imports System Imports System.Data Imports System.Math Imports Microsoft.SqlServer.Dts.Runtime #End Region 'ScriptMain is the entry point class of the script. Do not change the name, attributes, 'or parent of this class. _ _ Partial Public Class ScriptMain Inherits Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTARTScriptObjectModelBase 'This method is called when this script task executes in the control flow. 'Before returning from this method, set the value of Dts.TaskResult to indicate success or failure. 'To open Help, press F1. Public Sub Main() ' 'If DatePart(DateInterval.Weekday, Now()) = 5 Then 'For testing, change condition to set SendMail to True no matter the day of the week If DatePart(DateInterval.Weekday, Now()) >= 1 And DatePart(DateInterval.Weekday, Now()) <= 7 Then Dts.Variables("SendMail").Value = True End If ' Dts.TaskResult = ScriptResults.Success End Sub #Region "ScriptResults declaration" 'This enum provides a convenient shorthand within the scope of this class for setting the 'result of the script. 'This code was generated automatically. Enum ScriptResults Success = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Success Failure = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure End Enum #End Region End Class