Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
igorblackbelt
Constraint Violating Yak Guru
407 Posts |
Posted - 2006-03-15 : 11:50:19
|
Guys -Dumb question, How do you guys have your VB script set in order to setup date global variables in a DTS package that would set let's say:Date1 = Today's DateDate2 = Yesterday's DateI wrote a code that does that, but everytime it gets to the first of the month, I get "Date2" with current month and last day of previous month.See my code below and thanks for the help.Function Main() if not (isdate(dtsglobalvariables("YesterdaysDate"))) then dtsglobalvariables("YesterdaysDate")=formatdatetime(date()-1,2) end if dtsglobalvariables("TodaysDate") =formatdatetime(cdate(dtsglobalvariables("YesterdaysDate"))+1,2) Main = DTSTaskExecResult_SuccessEnd Function---Thanks!Igor. |
|
RickD
Slow But Sure Yak Herding Master
3608 Posts |
Posted - 2006-03-16 : 07:53:07
|
Not too sure if you can as usually do this in T-SQL instead, but use DateAdd("d",-1,date()) rather than date()-1.. |
 |
|
|
|
|