none
Dynamically creating destination table`

    Question

  • Hi Experts

      I am having 800 .dbf file from Foxpro database, now i want to import data from all .dbf file to SQL server, how to create destination table dynamically as same name as Source table.'

     because creating 800 tables in SQL server as source as vary difficult,please help me how to create it.

     thanks in advance.


    Thanks - SelvaKumarSubramaniam.Please MARK AS ANSWER, if my answer is useful to U.

    Sunday, November 10, 2013 6:31 PM

Answers

All replies


  • hi 

    you can select foreach loop 

    after that you chose script task and convert your object to string 

    can create string and next use oldbe destination.

    Sunday, November 10, 2013 7:49 PM
  • Thanks alot, but i have small doubt is this method create destination table as same name as Source table, please guide me,

    Thanks - SelvaKumarSubramaniam.Please MARK AS ANSWER, if my answer is useful to U.

    Monday, November 11, 2013 1:19 PM
  • see

    http://visakhm.blogspot.com/2013/08/importing-dbf-files-to-ssis.html

    For creating dynamic destination table you just need to have execute sql task with CommandType option as variable and hold in a variable in SSIS the CREATE TABLE statement. The name of table you can keep same as DBF tab by taking the value inside for each loop and then using it in expression for variable where you store query

    ie for Query variable expression would be like

    "CREATE TABLE " + @[User::SheetName] + " ( Column1... )"
    
    Where SHeetName is variable inside which you get tabname from the for each loop.

    You should set EvaluateAsExpression property to true for query variable.

    Monday, November 11, 2013 1:36 PM
  • I have the same issue.  I understand the CREATE TABLE statement, but how can I dynamically get the Columns list to put in the script?

    Tuesday, April 08, 2014 10:51 PM