dbTalk Databases Forums  

RUNNING VBA IN AN SSIS PACKAGE

comp.databases.ms-sqlserver comp.databases.ms-sqlserver


Discuss RUNNING VBA IN AN SSIS PACKAGE in the comp.databases.ms-sqlserver forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
robboll@hotmail.com
 
Posts: n/a

Default RUNNING VBA IN AN SSIS PACKAGE - 02-02-2010 , 10:22 PM






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

Reply With Quote
  #2  
Old   
robboll@hotmail.com
 
Posts: n/a

Default Re: RUNNING VBA IN AN SSIS PACKAGE - 02-02-2010 , 10:26 PM






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.

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.