343
343

Reputation: 305

How do I fetch only records created in the past year from a table within SSIS package?

I have a column CT_DT in a table. I have to process only transactions created within the past 365 days.

For example, suppose the current date is Nov 7, 2012, I have to process only those transaction that were created since Nov 7, 2011. I am using conditional filter within the SSIS package.

Upvotes: 0

Views: 1757

Answers (1)

user756519
user756519

Reputation:

You can filter the data in the query you might be using on the data source within the data flow task.

Query to filter the data on the source:

SELECT  column1
    ,   column2
    ,   column3
FROM    dbo.MyTable
WHERE   DATEDIFF(YEAR, CT_DT, GETDATE()) <= 1

If you absolutely want to filter the data on the Conditional Split transformation within the Data Flow task, create a new output and set it to the following expression:

Expression for Conditional Split:

DATEDIFF("yy", CT_DT, GETDATE()) <= 1

Your conditional split will look something like this.

Conditional split

Upvotes: 3

Related Questions