Share via

ssis - rename file

nononame2021 256 Reputation points
Nov 17, 2021, 10:59 AM

how can I rename the output file to add datetime for output excel file after export the excel file from ssis. can I add a task after generate excel file.

any reference?

SQL Server Integration Services
SQL Server Integration Services
A Microsoft platform for building enterprise-level data integration and data transformations solutions.
2,656 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Yitzhak Khabinsky 26,461 Reputation points
    Nov 17, 2021, 12:49 PM

    Hi @nononame2021 ,

    In SSIS it is usually done by using File System Task.
    Check it out here: rename-file-using-file-system-task-in-ssis

    0 comments No comments

  2. CarrinWu-MSFT 6,891 Reputation points
    Nov 18, 2021, 7:31 AM

    Hi @nononame2021 ,

    Welcome to Microsoft Q&A!

    Yes, you could rename file name by using File system task, like YitzhakKhabinsky-0887 mentioned. Please refer to below details:
    FullFilePath Expression: @[User::FilePath]+"\\"+@[User::FileName]

    RenameFilePath Expression:

    @[User::FilePath] + "\\" +  
    SUBSTRING(@[User::FileName], 1, FINDSTRING(@[User::FileName],".",1) -1 ) + (DT_WSTR,4)YEAR(GETDATE()) + (DT_WSTR,2)MONTH(GETDATE()) + (DT_WSTR,2)DAY(GETDATE()) +   
    SUBSTRING(@[User::FileName], FINDSTRING(@[User::FileName],".",1), LEN(@[User::FileName]))  
    

    150340-filesystemtask.png
    150541-filesystemtaskeditor.png

    Best regards,
    Carrin


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.