Quantcast
Channel: SQL Server Integration Services forum
Viewing all articles
Browse latest Browse all 24688

VBS Script 32 bit to 64 bit machine

$
0
0

I have this VB Script that works with an SSIS package. It runs the SSIS package and inputs the dates based on the value that is returned- "W" for week or "M" for month, it then puts the start and end date of either the month or week into an access table. I did not create this but I am trying to move the whole SSIS package over to a new server that is a Windows Server 2008 R2 64 bit operating system.

Below is the original Script I have tried everything to get this up and running and I am not sure what else to try.

I have tried to change the dates in SSIS but have not been able to find a way, I have tried to convert this to a VB.net file and run it, and that has not worked, I have tried altering the connection to every kind imaginableand I have looked up switching it a bat file... Any other ideas?

If I could at least populate the dates in access that would great and I could figure out what to do from there. The dates are needed first at the SSIS package uses them when it runs!

Thanks!

'#################################################
WEEKLY version
'#################################################

Dim varPath 

'#####SET SSIS PACKAGE PATH#####
varPath = "\\C:\Package.dtsx"
'###############################
'#############################
IsThisMonthOrWeek = "W"
'#############################

'###CALL SUB###
PopulateMonthWeek
'###############

Set WshShell = WScript.CreateObject("WScript.Shell")

ReturnCode = WshShell.Run("%systemroot%\Syswow64\cmd.exe /C C:\Program Files (x86)\Microsoft SQL Server\100\DTS\Binn\dtexec.exe/FILE """ & varPath & """ /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 = "W" 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 


Viewing all articles
Browse latest Browse all 24688

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>