My source text file :
Cost Profit
3000 1500
4000 2800
Today is year 2011-01, my destination SQL table should be :
Year Month Cost Profit
2010 12 3000 1500
2010 12 4000 2800
I used Derived Column but failed :
Derived Column Name : year
Derived Column : <add as new column>
Expression : SUBSTRING( CONVERT(VARCHAR, DATEADD(MONTH,-1,GETDATE()), 101), 7, 4 )
Result : failed, very disappointed as this SUBSTRING works in SQL Query Analyzer, why it didn't work in SSIS.
Any ideal ? Thanks.