Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6586439
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T16:47:27+00:00 2026-05-25T16:47:27+00:00

I have an SSIS Package that passes a date param from a Package variable

  • 0

I have an SSIS Package that passes a date param from a Package variable to a Batch file as a parameter. The intent of the Batch file is to rename a predetermine file in an predetermined location such a date suffix is added to the file name where teh date suffix is in the format “_YYYY_MM.”

The issue that I am having is that when I run the SSIS BIDS 2005 package in the IDE, the following batch file renames the file without a leading zero in the month. however, when I run it through our scheduler on our test server, the file is properly renamed so that the month has a leading zero.

Is perhaps due to a potential difference in drivers?

Here is the code for the batch file:

ECHO OFF
SET CurrentFolder=%~dp0
SET ThisFileName=%~n0

REM The following line populates shared path variables used below
CALL %CurrentFolder%\Membob_SetPaths.cmd

SET LogFile=%LogFolder%\%ThisFileName%.log
ECHO %date% %time%  - *** BOJ %CurrentFolder%%ThisFileName%.cmd *** >> %LogFile%

SET ReportingDate=%1 
ECHO Logging to: %LogFile%
ECHO ReportingDate=%ReportingDate% >> %LogFile%

REM Rename the file from MEMBOB.csv to MEMBOB_YYYY_MM.csv, using the passed ReportingDate 
REM But before we rename, delete any file that might already have that target name.

@For /F "tokens=1,2,3 delims=/ " %%A in ("%ReportingDate%") do @( 
Set Month=%%A
Set Day=%%B
Set Year=%%C
)
REM if %Month% LSS 10 Set Month=0%Month%
SET NewFileName=MEMBOB_%Year%_%Month%.csv

if exist %ExportFolder%\%NewFileName% del %ExportFolder%\%NewFileName%

REM Rename the file as described above
ECHO Rename %ExportFolder%\Membob.csv to %NewFileName% >> %LogFile%
rename %ExportFolder%\Membob.csv %NewFileName% 

ECHO %date% %time%  - *** EOJ %CurrentFolder%%ThisFileName%.cmd *** >> %LogFile%

I am really a noob with batch files.

What I would like to do is this, if someone can help:

Adjust the code so that it tacks on a leading zero if the length of the month when evaluated as a string is < 2.

Secondly, I would like this rename file procedure to be more generic so that I can pass in the file name full path as an additional param and have a suffix tacked onto ANY file.

Can someone with more BATCH prowess assist?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T16:47:28+00:00Added an answer on May 25, 2026 at 4:47 pm

    Since SSIS sucks a little less than batch files, another option is to get the package to format the date with a leading zero in teh month:

    Right("0"+ (DT_WSTR, 2) MONTH( @[User::ReportingMonth]  ) ,2) + "/" + Right("0"+ (DT_WSTR, 2) DAY( @[User::ReportingMonth]  ) ,2) + "/" + (DT_WSTR, 4) YEAR( @[User::ReportingMonth]  )  
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a SSIS 2005 package that needs to read from an XML file,
I have a SSIS package that reads from a flat file source. The target
I have ssis package in that I'm taking values from flat file and insert
I have created ssis package that is taking data from excel file and insert
I have a ssis package that does the following copies a file from an
I have an SSIS package that does the following: Selects the connection strings from
I have an SSIS package that queries data from a view using an SQL
I have written an SSIS package that essentially takes data from multiple sources and
I have an SSIS exportation package that is used to export data from an
I have an SSIS Package that is copying data from a column that is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.