locked
Multiple Flat File Move to Sqlserver Table with file source and destinition path RRS feed

  • Question

  • Actually what i have to do

    i have some flat file with same file structure in one folder ,

    than i have to move it in to one table in sql server along with i have to create one table which have file_name,source_file_path, Desti_Path, NoOfRecords and date_time of file.

    Along with i have create one destinition folder which have those file along with file name like file1_01/24/2013.txt

    Thursday, January 24, 2013 8:42 AM

Answers

All replies

  • Actually what i have to do

    i have some flat file with same file structure in one folder ,

    than i have to move it in to one table in sql server along with i have to create one table which have file_name,source_file_path, Desti_Path, NoOfRecords and date_time of file.

    Along with i have create one destinition folder which have those file along with file name like file1_01/24/2013.txt

    • Merged by David Dye Thursday, January 24, 2013 11:41 AM Identical post
    Thursday, January 24, 2013 8:38 AM
  • please answer somebody it's needed

    Thursday, January 24, 2013 8:47 AM
  • Actually what i have to do

    i have some flat file with same file structure in one folder ,

    than i have to move it in to one table in sql server along with i have to create one table which have file_name,source_file_path, Desti_Path, NoOfRecords and date_time of file.

    Along with i have create one destinition folder which have those file along with file name like file1_01/24/2013.txt


    pleaseeeee helpppppppppp
    Thursday, January 24, 2013 8:53 AM
  • Use a for each loop container to loop through files

    Inside you can place a data flow task to transfer data

    An execute SQL task to enter the file details if you want the files creation date then add a script task to load the file details using a directoryinfo and fileinfo objects.

    A filesystem task will be needed to move the file with destination path aa an expression or a variable

    The file name cannot contain / so use some other delimiter


    --------------------------------------------------------

    Surender Singh Bhadauria

    My Blog

     

    Thursday, January 24, 2013 9:00 AM
  • Hi Devesh,

    1) Use foreach loop for the multiple files use for each file enumerator.

    2) Use one DFT and one Execute SQL task in your for each container.

    3) In For each loop use one variable which will get the filename along with path.

    4) In first DFT use Row count tranform and use one SSIS variable to count the number of records and load the data in the destination.

    5) in execute SQL task use insert statement

    Insert into tablename values(?,?,?,?,getdate())

    map all the corresponding variables which we made for file name and sourcepath and target path you know how you are getting and rowcount variable for number of records.

    Please mark it as helpful if it helps.

    Thanks

    Sumit

    • Proposed as answer by David Dye Thursday, January 24, 2013 11:38 AM
    Thursday, January 24, 2013 9:36 AM
    • Marked as answer by Eileen Zhao Wednesday, January 30, 2013 6:55 AM
    Thursday, January 24, 2013 9:38 AM
  • thank so Much SUMIT
    Thursday, January 24, 2013 10:23 AM
  • SumitKumarDua  is correct, but you will also need to use a dynamic connection for the file.  The below link provides the steps necessary to create the data flow task to dynamically iterate throught the files in the folder:

    http://sqlsafety.blogspot.com/2010/09/ssis-dynamic-connections.html

    Hope this helps.


    David Dye http://sqlsafety.blogspot.com/

    • Marked as answer by Eileen Zhao Wednesday, January 30, 2013 6:55 AM
    Thursday, January 24, 2013 11:38 AM