SSIS package script task problem

  • Hi Guys,

    I have a strange issue with an SSIS package whereby it is putting in an incorrect file name somehow. The package creates a number of .csv files and names the for example Contacts_YYYYMMDD.csv. The date part of the file name is obtained using getdate etc.

    However when my script task goes to SFTP the files to the relevant location it puts in the same date over and over again which is a historic date.

    I thought initially that perhaps the connection managers for the files where retaining a link to an old file and that is what the Script task was getting but these have the correct file names when I look at them.

    What is more strange is that the SFTP task doesn't explicitly reference the file names but rather uses PUTFILES *.csv etc.

    Can anyone recommend a way I can get the filenames to be correct e.g. for today and not for some specific past date.

    Many thanks in advance!

    N

  • Neil.McKinnon (9/16/2015)


    Hi Guys,

    I have a strange issue with an SSIS package whereby it is putting in an incorrect file name somehow. The package creates a number of .csv files and names the for example Contacts_YYYYMMDD.csv. The date part of the file name is obtained using getdate etc.

    However when my script task goes to SFTP the files to the relevant location it puts in the same date over and over again which is a historic date.

    I thought initially that perhaps the connection managers for the files where retaining a link to an old file and that is what the Script task was getting but these have the correct file names when I look at them.

    What is more strange is that the SFTP task doesn't explicitly reference the file names but rather uses PUTFILES *.csv etc.

    Can anyone recommend a way I can get the filenames to be correct e.g. for today and not for some specific past date.

    Many thanks in advance!

    N

    While I'm sure you understand what you are trying to say, I'm not at all clear as to exactly what is taking place. First, it seems odd that you would mention getdate as a means of deriving a date via a Script Task, as the script would be in VB or C#, and that would mean using a function such as Now() or Today() in VB, or the C# equivalent. It would seem excessive to connect to SQL Server just to use GETDATE(). Thus I'm already uncertain about EXACTLY what your script is supposed to do, beyond output some CSV files with the date as part of the filename. One way you might be using GETDATE() is that you connect to SQL Server in the script task to get some data from SQL Server and part of the query uses GETDATE(), so at least one of the fields in the recordset has the date in it, and could thus be used as the date source. The problem here is that we can't see your script, so we have absolutely nothing to go on as to where in this process things are going wrong. I'm not as all sure what you mean when you say "when my script task goes to SFTP the files to the relevant location it puts in the same date over and over again which is a historic date." Where, exactly, does this "historic date" appear? Is it the file system's created date or last modified date? Is it the filename itself? Please explain in detail, and if possible, post the script itself.

    Steve (aka sgmunson) 🙂 🙂 🙂
    Rent Servers for Income (picks and shovels strategy)

  • Hi Steve,

    Apologies I wasn't clear. That said I have managed to fix my issue, but wish to thank you all the same for your kind response.

    Kind regards,

    Neil

  • Neil.McKinnon (9/16/2015)


    Hi Steve,

    Apologies I wasn't clear. That said I have managed to fix my issue, but wish to thank you all the same for your kind response.

    Kind regards,

    Neil

    Glad you were able to resolve your issue. You may want to describe what the problem was, and how you fixed it, so that someone else might find this post in the future and see how the issue was resolved. That's why this forum exists.

    Steve (aka sgmunson) 🙂 🙂 🙂
    Rent Servers for Income (picks and shovels strategy)

Viewing 4 posts - 1 through 3 (of 3 total)

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