Archiving on the basis of date

  • Hi All,

    I'm archiving a table based on the date info. The output file name should be decided on which Qtr it falls with the combination of year.

    for example if the record contains date as 15/2/2011 then output file name shuld be 'tblQtr1_2011'

    if the date is 15/5/2010 the output file name should be 'tblQtr2_2010'

    how can i name the output file depending on the input info.

    Thanks,

    Regrds,

    ami

  • Hi Anamika,

    Get the month part of MAX(date_column) and use a SWITCH case in the script to name the file accordingly.

    Raunak J

  • MONTH(mth) == 1 || MONTH(mth) == 2 || MONTH(mth) == 3

    MONTH(mth) == 4 || MONTH(mth) == 5 || MONTH(mth) == 6

    ........

    using the above statement i'm finding out the QTR info about the table.

    but im finding difficult to get the year

  • Anamika,

    Get the YEAR part of MAX(date_column)

    Raunak J

  • my question is how to bring the year(mth) from the transformation and how to put the same in expressions of flat file connection?

    in flat file conn i can't get the column names.

    i can get only the variables.

    so i shud give the year to the variable must be using script task i guess.

    any thoughts?

  • Run the desired SQL and store the value(s) in SSIS variable(s). Use a Script Task or a Flat File destination.

    Remember to create a dynamic file connection manager if you wish to use Flat file destination.

    Raunak J

Viewing 6 posts - 1 through 5 (of 5 total)

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