Prev: Using @variable in WHERE clause when querying a view is horrible. Inline function is fine. Why?
Next: Backups without data?
From: robboll on 2 Feb 2010 22:22 I am running an SSIS job manually that I am trying to automate. To automate the task the job needs to run daily and execute when a condition is met. The condition is based on a maintenance table: r_apd that looks as follows: FY PER CLSD_FL 2009 11, 1 2009 12 1 2009 13 1 2010 1 1 2010 2 1 2010 3 1 2010 4 0 <-- current 2010 5 0 2010 6 0 So during the 4th period (above) it will run at the end of each day until CLSD_FL is updated to 1 How do I incorporate VBA code for current Fiscal Year and Fiscal Month so that the SSIS job can use it? In the following VBA (used in MS Access) I am deriving the Fiscal Year and the Fiscal Month. I would like to do something similar using a Scrip Task in SSIS. Using this code in an SSIS script task does not work. If not using this code does anyone have any method that I may be able to use? Also any examples or web references would help a lot. Thanks! '=============START CODE Option Compare Database Option Explicit Const FMonthStart = 10 ' Numeric value representing the first month ' of the fiscal year. Const FDayStart = 1 ' Numeric value representing the first day of ' the fiscal year. Const FYearOffset = -1 ' 0 means the fiscal year starts in the ' current calendar year. ' -1 means the fiscal year starts in the ' previous calendar year. Function GetFiscalYear(ByVal X As Variant) If X < DateSerial(Year(X), FMonthStart, FDayStart) Then GetFiscalYear = Year(X) - FYearOffset - 1 Else GetFiscalYear = Year(X) - FYearOffset End If End Function Function GetFiscalMonth(ByVal X As Variant) Dim m m = Month(X) - FMonthStart + 1 If Day(X) < FDayStart Then m = m - 1 If m < 1 Then m = m + 12 GetFiscalMonth = m End Function '=====================END CODE RBollinger
From: robboll on 2 Feb 2010 22:26
To clarify when I said: So during the 4th period (above) it will run at the end of each day until CLSD_FL is updated to 1 What I mean is that the SSIS job runs daily but doesn't execute unless CLSD_FL is updated to 1. |