Home Forums SQL Server 2005 Business Intelligence Import Dynamic File Name with a Date/Time as the file type (YYYYMMDDHRMMSS) RE: Import Dynamic File Name with a Date/Time as the file type (YYYYMMDDHRMMSS)

  • SQL_Enthusiast (5/31/2013)


    For some unknown reason, the creator of this file set the naming convention to something I can't begin to fathom... :unsure:

    The file name is like this: NAME1_NAME2_NAME3_NAME4_NAME5_YYYYMMDD_YYYYMMDDHRMMSS.YYYYMMDDHRMMSS -- Yes, twice...! And the folder continues to grow. So I need to pick up the most recent file...

    I have figured out ways to pick up a dynamic name that ends in CSV or TXT (*.csv or *.txt), but I have never tried to figure out a dynamic file type before. If it helps, the NAME#'s never change. Only the date/times change.

    Is there anythign I can do pick up the most recently added file in a folder where the file name and type continually change? Maybe a VB script???

    What are you using to do imports for things that end with CSV or TXT?

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)