Get First and Last day of month and Insert into Access table
I am currently moving over an SSIS package that was triggered by a VBScript, the package was orignially on a 32 biit machine and is now on a 64 so the VBScript does not work. The main function of the script is to insert the first and last day of the previous month into an access table. Those dates are then used later in the package. I am looking for a way to do this either through SSIS or any other function, I have tried execute SQL task and that has not seemed to work (in my other post), I have also tried to convert the script to ActiveX, run it through a data flow and execute process task to run the original 32 bit script. I have pasted the script below, Any suggestions on how to run the script or insert the dates into the access table are welcome. Thank you! '################################################# 'ZierdMONTHLY version '################################################# Dim varPath '#####SET SSIS PACKAGE PATH##### varPath = "C:\Package.dtsx" '############################### '############################# IsThisMonthOrWeek = "M" '############################# '###CALL SUB### PopulateMonthWeek '############### Set WshShell = C:\Windows\SysWOW64\WScript.CreateObject("WScript.Shell") ReturnCode = WshShell.Run("dtexec.exe /FILE """ & varPath & """ /DECRYPT apple MAXCONCURRENT "" -1 "" /CHECKPOINTING OFF /REPORTING EWCDI ") '######################################################################################### SUB PopulateMonthWeek set con = createobject("ADODB.Connection") dbPath = "C:\dealer.mdb" conString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & dbPath & ";User Id=admin;Password=;" con.open conString IF IsThisMonthOrWeek = "M" THEN con.execute "update tbl_startEndDates set weekOrMonth = '" & IsThisMonthOrWeek & "', startDate = '" & getFirstDayOfMonth & "', endDate = '" & getLastDayOfMonth & "'" ELSE con.execute "update tbl_startEndDates set weekOrMonth = '" & "W" & "', startDate = '" & Date() - WeekDay(Date())-6 & "', endDate = '" & Date() - WeekDay(Date()) & "'" END IF con.close set con=nothing END SUB FUNCTION getFirstDayOfMonth valMonth= month(now())-1 valYear= Year(now()) if valMonth = 1 then valMonth = 12 valYear = valYear-1 end if getFirstDayOfMonth = valMonth & "/1/" & valYear END FUNCTION FUNCTION getLastDayOfMonth valMonth= month(now())-1 valYear= Year(now()) if valMonth = 1 then valMonth = 12 valYear = valYear-1 end if din = valMonth & "/1/" & valYear getLastDayOfMonth = dateserial(year(din),month(din)+1,0) END FUNCTION
September 11th, 2012 3:18pm

If you're using a SQL Agent Job to run your SSIS package, then: If you're using SQL Server 2008, there should be a checkbox on the Job Step page to run the package in 32-bit mode. Let us TRY this | My Blog :: http://quest4gen.blogspot.com/
Free Windows Admin Tool Kit Click here and download it now
September 11th, 2012 3:28pm

Thank you for your reply, I wish I was using using SQL server agent however that is not available, I have been using task scheduler, to schedule the tasks is there a similar option in that?
September 11th, 2012 3:37pm

Open your package in BIDS and set the properties of the solution to RUN6rBitRunTime to FALSE. Solution->Properties->Debugging->RUN64BitRunTime =FALSE replace your old package with this @task scheduler... let us know your observation Let us TRY this | My Blog :: http://quest4gen.blogspot.com/
Free Windows Admin Tool Kit Click here and download it now
September 11th, 2012 4:00pm

The RUN64BitRunTime has already been set to FALSE. I am not sure what you mean by replace the old package with the @task scheduler. The task scheduler was set to run the VB script that updated the access table then ran the SSIS package.
September 11th, 2012 4:34pm

I actually figured this out as an execute SQL Task in SSIS to get dates solution is here: http://biwithdanide.blogspot.com/2012/09/first-and-last-days-of-month-and-week.html
Free Windows Admin Tool Kit Click here and download it now
September 17th, 2012 2:58pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics