SSIS Question Help

  • Koen Verbeeck (8/26/2013)


    rocky_498 (8/26/2013)


    Thanks, that was I was thinking....

    I am thinking how about If I get Recent file name from folder?

    Is anyone can please guide me how i can recent file name from folder in SSIS?

    Thank You,

    You want the most recent file from the folder?

    You'll probably want to do this with a script task, using some .net code.

    http://stackoverflow.com/questions/1179970/c-sharp-find-most-recent-file-in-dir

    Heh... isn't that nice... someone took the time to create the DOS DIR command with a /o-d switch in C#. 😉 I don't know much about SSIS but why can't you use something like a CmdExec task and take the top 1 from that return? Better yet, isn't there some way to get and loop through a list of files in a certain order. Couldn't you setup a single iteration loop for such a thing?

    --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)

  • Jeff Moden (8/27/2013)


    Koen Verbeeck (8/26/2013)


    rocky_498 (8/26/2013)


    Thanks, that was I was thinking....

    I am thinking how about If I get Recent file name from folder?

    Is anyone can please guide me how i can recent file name from folder in SSIS?

    Thank You,

    You want the most recent file from the folder?

    You'll probably want to do this with a script task, using some .net code.

    http://stackoverflow.com/questions/1179970/c-sharp-find-most-recent-file-in-dir

    Heh... isn't that nice... someone took the time to create the DOS DIR command with a /o-d switch in C#. 😉 I don't know much about SSIS but why can't you use something like a CmdExec task and take the top 1 from that return?

    That's possible as well 😉

    (I was around 5 years old when DOS was common use, so I'm not really up to speed with it's language :-))

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • Glad some things never change.

    I edited my post without realizing that you had responded. Isn't there some "For Each" loop that can get and loop through files in a certain order and just limit the number of iterations to 1?

    --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)

  • Jeff Moden (8/27/2013)


    Glad some things never change.

    I edited my post without realizing that you had responded. Isn't there some "For Each" loop that can get and loop through files in a certain order and just limit the number of iterations to 1?

    Yes, there's a FOR loop, but I don't think you can specify a fixed order. (hence my suggestion for .NET where you have more control)

    Hey, I never said SSIS was perfect 😉

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • Koen Verbeeck (8/27/2013)

    Yes, there's a FOR loop, but I don't think you can specify a fixed order. (hence my suggestion for .NET where you have more control)

    Hey, I never said SSIS was perfect 😉

    I've created several packages for SSIS which look for the most recent file in a directory, and I've never found a way other than using a .NET script, or at least not one that isn't as much if not more work.

    ____________
    Just my $0.02 from over here in the cheap seats of the peanut gallery - please adjust for inflation and/or your local currency.

  • You can also browse Microsoft script center for the VB script, PowerShell etc scripts.

    http://gallery.technet.microsoft.com/scriptcenter

    Click on Storage in the left column and then Files

    One word of caution: if you are looking for the latest file name mind how the date time part of the name is formated and sorted: dictionary order or number order. In the dictionary order 12 comes earlier than 2 and PM and AM numbers are mixed together.

    Yelena

    Regards,Yelena Varsha

Viewing 6 posts - 16 through 20 (of 20 total)

You must be logged in to reply to this topic. Login to reply