Results 1 to 6 of 6
  1. #1
    Join Date
    Mar 2010
    Posts
    15

    Unanswered: Insert row into a flat file.

    I need a good suggestion on the best technic to use to insert a new row into an existing flat file with 2 or more rows, anywhere in the file above the trailer record of all 9's.

    For example, the existing flat file may contain the following data by column alignment:

    Column Header names not included in the flat file,
    Column Header names =
    Customer_Name, Customer#, Balance, Payment

    John Doe 000123 2500.00 500.00
    Jerry Jones 000201 3500.00 650.00
    Troy Aikman 000550 1550.50 275.00
    99999999999999999999999999999999999999999999999999 9

    I want to insert the following row anywhere above the trailing row of 9's:

    Emmit Smith 000355 4250.00 785.00

    Any suggestions?

  2. #2
    Join Date
    Nov 2003
    Posts
    2,933
    Provided Answers: 12
    This is defintely the wrong forum to ask questions about flat files.

    This forum is for discussing problems with Microsoft's relational database "SQL Server"

  3. #3
    Join Date
    Mar 2010
    Posts
    15
    I will rephrase the question. I want to be able to manipulate the flat file by importing it into a SQL 2000 or 2005 table, insert the rows, then re-write the data to the flat file with the inserted row.

  4. #4
    Join Date
    Mar 2010
    Posts
    15
    "I will rephrase the question. I want to be able to manipulate the flat file by importing it into a SQL 2000 or 2005 table, insert the rows, then re-write the data to the flat file with the inserted row."

  5. #5
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    Your question leads to many more questions. You need to clarify things a bit before I could even start to formulate an answer.

    Are you creating a flat file from a SQL Server data source or maintaining an existing file? What do you do with the file once you like its contents? Is the file on a Windows machine?

    -PatP
    In theory, theory and practice are identical. In practice, theory and practice are unrelated.

  6. #6
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    Oh very nice! You responded whilst I was composing my questions (I got side-tracked).

    Import the file into a table, insert the new data into your table, export the table into a file. You can do this manually, via SSIS, or other ways. We need more insight into what you want before we can help you get it.

    -PatP
    In theory, theory and practice are identical. In practice, theory and practice are unrelated.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •