SSIS remove _datetimestamp from .txt file

dinesh 41 Reputation points

Hi, I would like to import xyz_abc_12346_09262022.txt into DB. This 09262022"" part is date part and it will change daily. How do I ignore this 09262022 (date part) while importing?

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

2 answers

Sort by: Most helpful
  1. ZoeHui-MSFT 33,551 Reputation points

    Hi @dinesh ,

    You may use substring to do that since you know the exact length of the full filename.

    SUBSTRING ("xyz_abc_12346_09262022.txt",1,7)+".txt"  
    SUBSTRING ([yourfilename],1,7)+".txt"  


    Or you may try with C# said here ssis-script-to-remove-date-from-file-name.


    Zoe Hui

    If the answer is helpful, please click "Accept Answer" and upvote it.

    0 comments No comments

  2. dinesh 41 Reputation points

    But while importing into DB this will fail because of filename not found, right?