SQL Server Developer Center > SQL Server Forums > SQL Server Integration Services > question on creating package with changing source table names
Ask a questionAsk a question
 

Answerquestion on creating package with changing source table names

  • Wednesday, November 04, 2009 4:33 PMarchies09 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hi,


    I need to create a package. But the source table names changes everyquarter. For example FY10_Q1_TABLEA AND NEXT TIME FY10_Q2_TABLEA so on....


    How can I create a package with these changing table names for 4 quarters?


Answers

  • Wednesday, November 04, 2009 4:42 PMPhil BrammerMVP, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    You will need to use package configurations to pass in the name of the table.

    http://msdn.microsoft.com/en-us/library/ms141682.aspx

    The best thing to do will be to build a variable that holds the table name, then build another variable that uses an expression to set its value.  The expression for the second variable will be a SQL statement that you will use in your OLE DB Source component in the data flow.  Something like, "SELECT Col1, Col2, etc... FROM " + @[User::TableNameVar]

    Then you can use the second variable as the source in your OLE DB Source.
    Phil Brammer | http://www.ssistalk.com | Twitter: http://twitter.com/PhilBrammer

All Replies

  • Wednesday, November 04, 2009 4:42 PMPhil BrammerMVP, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    You will need to use package configurations to pass in the name of the table.

    http://msdn.microsoft.com/en-us/library/ms141682.aspx

    The best thing to do will be to build a variable that holds the table name, then build another variable that uses an expression to set its value.  The expression for the second variable will be a SQL statement that you will use in your OLE DB Source component in the data flow.  Something like, "SELECT Col1, Col2, etc... FROM " + @[User::TableNameVar]

    Then you can use the second variable as the source in your OLE DB Source.
    Phil Brammer | http://www.ssistalk.com | Twitter: http://twitter.com/PhilBrammer