How to rename the file on the base of the query output in SSIS

  • Hi All,

    I want to rename the file on the base of query output in SSIS.

    Example:

    File name: report.txt

    Query: Select MAX(Batchlog) from Account -- Query Output is 100

    So, file name will be report100.txt

    Please help me how to do this using ssis package...

    Thanks in advance

    Jay

  • Please help me.I am struggling for whole day.

  • Hi All,

    Please share your knowledge with me.I am in very much hard time.

    Please help me to save my job.

    I will appreciate for your time.

    Thanks in advance

  • Jay Pete (1/7/2013)


    Hi All,

    I want to rename the file on the base of query output in SSIS.

    Example:

    File name: report.txt

    Query: Select MAX(Batchlog) from Account -- Query Output is 100

    So, file name will be report100.txt

    Please help me how to do this using ssis package...

    Thanks in advance

    Jay

    If SSIS is a primary job function for you then I would urge you to start studying it as soon and as often as possible while not at work so you do not lose your job.

    Some tips:

    Use an Execute SQL Task to execute the SELECT statement you have shown. On the result set to be Single Row:

    Then on the Result Set page, click Add to add a new result set. Create a new variable (use the drop-down on your new resultset) of type Int32 to capture the result of COUNT() in your query.

    Click OK to save everything in your Execute SQL Task.

    When the Execute SQL Task runs it will store the value 100 (from your example) in the variable which you can use later in a File System Task to rename your file.

    On the File System Task you'll want to set it to "Rename a file" and use the variable in an Expression to determine the resulting file name.

    If you get stuck with any of this post back, or post a new thread to get more help.

    There are no special teachers of virtue, because virtue is taught by the whole community.
    --Plato

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

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