SSIS file iteration and insert in 2008

we have a directory , which has around 10 files. I need to iterate the all the files in the directory and insert the file name, file count and other details into one of the table of the database. 
Once the data/file name is inserted into the parent table , and id will be generated (auto generated value ) which need to be  inserted into the child table.
please suggest the best possible optimum how can it be done in SSIS 2008.

Break it into subtasks:
" iterate the all the files" -- use a ForEach Loop with file iterator. Google/Bing on how to
"insert the file name, file count and other details" capture the file name value from the iteration to a variable mapped to it, the count can be done via a Script Task with a simple iterator, again Bing;
"id will be generated" -- id where , how? Not sure, but perhaps just do it via a trigger. I am asking because each records would not one per file unless you did something special
Arthur My Blog

Similar Messages

  • JClient Binary File Upload and Insert

    We are looking for ways to upload and insert a pdf or other binary file into a view object using JClient on the client tier. Can anyone point us to sample code for this?

    this should do this
    ApplicationModule appmod = panelBinding.getApplicationModule();
    JUApplication app = panelBinding.getApplication();
    ViewObject vo_calldoc = appmod.findViewObject("CallDocsView1");
    Row newdoc = vo_calldoc.createRow();
    newdoc.setAttribute("CdcCalId", PanelCallView3.vo_call.getRowSet().getCurrentRow().getAttribute("CalId"));
    newdoc.setAttribute("CdcFilenaam",file.getName());
    newdoc.setAttribute("CdcBlob",blob);
    vo_calldoc.insertRow(newdoc);
    appmod.getTransaction().postChanges();
    Object[] inskey = new Object[]{ newdoc.getAttribute("CdcId")};
    appmod.getTransaction().commit();
    Key pkkey = new Key(inskey);
    Row[] rowarray = vo_calldoc.findByKey(pkkey,1);
    Row updrow = rowarray[0];
    System.out.println(updrow.getAttribute("CdcFilenaam"));
    updrow.lock();
    oracle.jbo.domain.BlobDomain myblob = (oracle.jbo.domain.BlobDomain)updrow.getAttribute("CdcBlob");
    int next;
    FileInputStream fileIn = new FileInputStream(file);
    OutputStream blobOut = myblob.getBinaryOutputStream();
    while ((next = fileIn.read()) != -1)
    blobOut.write(next);
    fileIn.close();
    blobOut.close();
    app.commitTransaction();

  • Combine csv files and insert source filename

    Newbie powershell question - Need help combining multiple csv files (100+) and inserting a column containing the name of the source file
    ex: 
    Apples.csv
    A,B,C,D
    1,2,3,4
    Oranges.csv
    A,B,C,D
    1,2,3,4
    Desired output would look like this:
    combined.csv
    A,B,C,D,Filename
    1,2,3,4,Apples.csv
    1,2,43,4,Oranges.csv

    I did see a post with something similar to what I wanted to accomplish but it wouldn't work for me since my file names will change and I am not going to create a variable for each file
    $CSV1 = Import-CSV c:\csv1.csv
    $CSV2 = Import-CSV c:\csv2.csv
    $Result = New-Object PSObject -Properties @{
    Field1 = $CSV1.Field1
    Field2 = $CSV1.Field2
    Source1 = "CSV1"
    Field3 = $CSV2.Field1
    Field4 = $CSV2.Field2
    Source2 = "CSV2"
    $Result | Export-CSV c:\Result.csv -NoTypeInformation

  • Php - get name from 'file field' and pass to database?

    Is it possible to extract the 'image' name from the 'file' field and insert it into a database using php?
    <input type="file" name="ImageName" id="ImageName">
    I can't have:
    $ImageName = trim($_FILE['ImageName']);
    So hows this handled?
    Cheers
    Os

    Murray *ACP* wrote:
    Should be pretty strightforward, Os.  You know where to ask the questions!
    Yeah.. but I keep coming up against brick walls
    I'm trying to manipulate David Powers PHP Solutions chapter 6 - Uploading Files.
    He's got some sort of complicated function going on which makes sure no two images which are uploaded to a folder have the same name. i.e., london.jpg becomes london_1.jpg. (the php even inserts underscores if there are gaps in the image name)
    If I just use $ImageName = $_FILES["ImageName"]["name"]; potentially I could end up with dozens of images with the same name in the database, which is NOT desirable.
    Of course I could simplyfy everything and use two forms - 1 for uploading the images to the upload folder and then one for inserting the images details into the database BUT that has the drawback of the client needing to type in the name of the image identically to match the name which has been generated in the upload folder and that aint gonna happen in a million years

  • SQL server 2014 and VS 2013 - BuilInsert task - truncate a field data of a CSV file and insert it to SQL table.

    Hello everyone,
    To move data from roughly 50 CSV files in a loop to SQL tables (table per CSV file), I've used BulkInsert task in For each loop container.
    Please know, for all different columns of all CSV files, the filed length was specified as varchar(255).
    It worked well for the first 6 files but on 7th file, it has found the data in one of the columns of CSV file, which exceeds the limit of 255 characters. I would like to truncate the data and insert the remaining data for this column. In other words, I would
    like to insert first 255 characters into table for this field and let the package execute further.
    Also, if I would use SQLBulkCopy in Script task, will it be able to resolve this problem? I believe, I would face the similar problem over there too. Although, would like to get confirmation for the same from experts.
    Can you please advise how to get rid of this truncation error?
    Any help would be greatly appreciated.
    Thanks, <b>Ankit Shah</b> <hr> Inkey Solutions, India. <hr> Microsoft Certified Business Management Solutions Professionals <hr> http://ankit.inkeysolutions.com

    Hello! I suggest you add a derived column transformation between Source and Destination, use string functions to extract first 255 characters from the incoming field and send this output to destination field, that ways you can get rid of these sort of issues.
    Useful Links:
    http://sqlage.blogspot.in/2013/07/ssis-how-to-use-derived-column.html
    Good Luck!
    Please Mark This As Answer if it solved your issue.
    Please Vote This As Helpful if it helps to solve your issue

  • Using servlets to read from text file and insert data

    Hi,
    Can I use a servlet to read from a space delimited text file on the client computer and use that data to insert into a table in my database? I want to make it easy for my users to upload their data without having to have them use SQL*Loader. If so can someone give me a hint as how to get started? I appreciate it.
    Thanks,
    Colby

    Create a page for the user to upload the file to your webserver and send a message (containing the file location) to a server app that will open the file, parse it, and insert it into your database. Make sure you secure the page.
    or
    Have the user paste the file into a simple web form that submits to a servlet that parses the data and inserts it into your db.

  • I have a MacBook pro 10.6.8, 2.66 Ghz 8GB 1067MHz. Please does anybody know of software that can auto send emails to a word/pages doc. and insert in date order into a book file, so that you can open like a book

    I have a MacBook Pro 10.6.8, 2.66 Ghz,  8GB memory 1067Mhz running Snow Lepard. I am going mad with trying to organise emails and cross reference to file documents, also the first model iPad.
    Does anybod know if there is any softeware - pages or otherwise that can copy emails automatically to document files and insert them in dated order and also that the file can be reviewed like a book by flicking from bottom right hand corner iPad book style.
    Please help me run my contracts easily, it shouldn't be difficult in this day and age.
    I currently use Apple 'Mail' and microsoft word but am considering any new software that can organise and integrate mail better. I use photo inserts and scanned documents and excel spreadsheets.

    No, I don't know about that kind of software. It isn't Pages anyway. You need somekind of database.

  • Reading special characters from a flat file and inserting into DB

    I'm reading data with special characters like . etc from a flat file , assigning the data to variable in my anonymous block and inserting into my DB. But the show up as inverted ? s. Any clues about how to do this?
    If i try to do the insert directly it works. It seems like the error occurs when reading this data into a variable
    thanks for the help
    Lalit Bhatia

    lalit, this is probably an character set problem, the default on Database creation tends to be 7bit Ascii which does not support special characters, it's been a while since I set up a db in this way, but you need to change settings in oracle.ini. The db will need to be restarted for this. Also, to check current settings try:
    select * from NLS_DATABASE_PARAMETERS
    You want an 8bit, unicode or multibyte character set. Sorry I cannot remember moer off the top of my head, try searching on NLS or character set

  • To retrieve the PRT document (a PDF file) and insert the doc in PM order

    Hello guys,
    I have a challenging task in from printing as follows,
    By using TC: IW3D we get print preview of PM Order Set (PM Print Program: YIPRJT01), currently the PRT document number prints in the PM Order. Now we have to insert the PRT documents (a PDF file) into the PM Order set rather than printing the PRT document number ( By using TC: IW33 by going OPERTIONAL TAB we will get the PRT document(a PDF file))
    The requirement is to retrieve the PRT document (a PDF file) and insert the document in PM  order set with out navigating separately by using the TC: IW33.
    If you run the script in the print preview we can able to see PM the order set along with the PRT document (a PDF file).
    Thanks & Regards
    Vishnu

    I'm also trying to print PRT document with shop papers and still not able to do so. I selected "P" for print on the control key and it should print but still didn't print.
    If I understand it right, I think you are trying to do the same.
    Have you resolved this issue ?
    Thank you,
    Sam

  • How to create a table with datatype blob and insert a pdf file (ravi)

    how to create a table with datatype blob and insert a pdf file,
    give me the explain asap
    1.create the table?
    2.insert the pdffiles into tables?
    3.how to view the files?
    Thanks & Regards
    ravikumar.k
    Edited by: 895044 on Dec 5, 2011 2:55 AM

    895044 wrote:
    how to create a table with datatype blob and insert a pdf file,
    give me the explain asapPerhaps you should read...
    {message:id=9360002}
    especially point 2.
    We're not just sitting here waiting to answer your question as quickly as possible for you.

  • How can i open a DOC or TXT file and insert the data into table?

    How can i open a DOC or TXT file and insert the data into table?
    I have a doc file . the doc include some columns and some rows.(for example 'ID,Name,Date,...').
    I'd like open DOC file and I'd like insert them into the table with same columns.
    Thanks.

    Use the SQL*Loader utility or the UTL_FILE package.

  • Retrieve filename and insert in body of htm file?

    Is there a way in Dreamweaver CS4 to retrieve the filename of the current file and insert it into the body? I want to accomplish the following:
    retrieve: currentworkingfilename.htm
    replace: href="constant/filename.htm">  (this is a consistent string that appears in all files)
    with: href="currentworkingfilename.htm">
    Thanks for any help with this.

    You will need serverside script to achieve this. In PHP this would be $_SERVER["PHP_SELF"] as in
    <!doctype html>
    <html>
    <head>
    <meta charset="utf-8">
    <title>Untitled Document</title>
    </head>
    <body>
    <?php echo($_SERVER["PHP_SELF"]); ?>
    </body>
    </html>
    Gramps

  • Copy File name and Date only from a Folder with SSIS

    Hello all,
    I need to create a package which will list the file names and the dates in a folder, these files are blank flat files. After extracting the file names from the file path i need to create a table which will have two columns Filename and
    Date.We get about 1000 such files every month and we are looking to maintain them in a table.
    Is this possible? Can someone point me in the right direction? 
    FM

    Arthur , I actually figured it out. The For each container let me pass thru the file name, then I inserted the file name into my staging table. I created a FilePath variable and basically Did a sql task and
    INSERT INTO MyTable
    SELECT Filename = ?,
    LoadDate = GetDate()
    In my for each loop I added a *.*txt qualifier... I`ve tested and works well... Got what I needed.
    FM

  • Read a csv file, fill a dynamic table and insert into a standard table

    Hi everybody,
    I have a problem here and I need your help:
    I have to read a csv file and insert the data of it into a standard table.
    1 - On the parameter scrreen I have to indicate the standard table and the csv file.
    2 - I need to create a dynamic table. The same type of the one I choose at parameter screen.
    3 - Then I need to read the csv and put the data into this dynamic table.
    4 - Later I need to insert the data from the dynamic table into the standard table (the one on the parameter screen).
    How do I do this job? Do you have an example? Thanks.

    Here is an example table which shows how to upload a csv file from the frontend to a dynamic internal table.  You can of course modify this to update your database table.
    report zrich_0002.
    type-pools: slis.
    field-symbols: <dyn_table> type standard table,
                   <dyn_wa>,
                   <dyn_field>.
    data: it_fldcat type lvc_t_fcat,
          wa_it_fldcat type lvc_s_fcat.
    type-pools : abap.
    data: new_table type ref to data,
          new_line  type ref to data.
    data: xcel type table of alsmex_tabline with header line.
    selection-screen begin of block b1 with frame title text .
    parameters: p_file type  rlgrap-filename default 'c:Test.csv'.
    parameters: p_flds type i.
    selection-screen end of block b1.
    start-of-selection.
    * Add X number of fields to the dynamic itab cataelog
      do p_flds times.
        clear wa_it_fldcat.
        wa_it_fldcat-fieldname = sy-index.
        wa_it_fldcat-datatype = 'C'.
        wa_it_fldcat-inttype = 'C'.
        wa_it_fldcat-intlen = 10.
        append wa_it_fldcat to it_fldcat .
      enddo.
    * Create dynamic internal table and assign to FS
      call method cl_alv_table_create=>create_dynamic_table
                   exporting
                      it_fieldcatalog = it_fldcat
                   importing
                      ep_table        = new_table.
      assign new_table->* to <dyn_table>.
    * Create dynamic work area and assign to FS
      create data new_line like line of <dyn_table>.
      assign new_line->* to <dyn_wa>.
    * Upload the excel
      call function 'ALSM_EXCEL_TO_INTERNAL_TABLE'
           exporting
                filename                = p_file
                i_begin_col             = '1'
                i_begin_row             = '1'
                i_end_col               = '200'
                i_end_row               = '5000'
           tables
                intern                  = xcel
           exceptions
                inconsistent_parameters = 1
                upload_ole              = 2
                others                  = 3.
    * Reformt to dynamic internal table
      loop at xcel.
        assign component xcel-col of structure <dyn_wa> to <dyn_field>.
        if sy-subrc = 0.
         <dyn_field> = xcel-value.
        endif.
        at end of row.
          append <dyn_wa> to <dyn_table>.
          clear <dyn_wa>.
        endat.
      endloop.
    * Write out data from table.
      loop at <dyn_table> into <dyn_wa>.
        do.
          assign component  sy-index  of structure <dyn_wa> to <dyn_field>.
          if sy-subrc <> 0.
            exit.
          endif.
          if sy-index = 1.
            write:/ <dyn_field>.
          else.
            write: <dyn_field>.
          endif.
        enddo.
      endloop.
    REgards,
    RIch Heilman

  • How to read the data from XML file and insert into oracle DB

    Hi All,
    I have below require ment.
    I will receive data in the XML file. then i need to read that data and insert into oracle tables. please let me know how this can be handled.
    Many Thanks.

    Sounds a lot like this question, only with less details.
    how to read data from XML  variable and insert into table variable
    We can only help if you provide us details to help as we cannot see what you are doing and only know what you tell us.  Plenty of examples abound on the forums that cover the topics you seek as well.

Maybe you are looking for