Connect to previous months table


hi folks

i have database contains monthly tables contain sales data 

each month want extract sales data previous months table.  i.e  on 1st of march 2013  i want  schedule ssis package run load february data database. on april 1st want load march data , on. 

i.e tables in database have name structure follows 

  • sales_2012_11
  • sales_2012_12
  • sales_2013_01
  • sales_2013_02
  • sales_2013_03

what best way connect previous months sales table? because needs be scheduled package, want avoid having update table name in select statement in source connection manager. 

any suggestions welcome

regards

stevo



if data in different tables make the source table (or complete source query) dynamic.

create ssis variable type string , add expression. like:

"sales_" +  (dt_wstr,4)datepart("yyyy", dateadd("mm", -1, getdate())) + "_" + right("0" + (dt_wstr,2)datepart("mm", dateadd("mm", -1, getdate())), 2)


now can use variable in ole db source


please mark post answered if answers question | ssis blog: http://microsoft-ssis.blogspot.com | twitter




SQL Server  >  SQL Server Integration Services



Comments

Popular posts from this blog

Conditional formatting a graph vertical axis in SSRS 2012 charts

Register with Power BI failed

SQL server replication error Cannot find the dbo or user defined function........