Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6112531
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T14:45:20+00:00 2026-05-23T14:45:20+00:00

I have a flat file that is pipe delimited and an database table. I

  • 0

I have a flat file that is pipe delimited and an database table. I would like to create a 2nd flat file that contains all the differences between the flat file and the database.

An example would be if there exists entries in the database that do not exist in the flat file the entire row would be printed in the 2nd flat file (there will never be an entry in the flat file that is not in the database). Another example would be if the rows are similar but there is a difference in a field then the database entry would be printed in the flat file.

The best way I can think to do this is to create 2 two-dimensional arrays containing the data from the flat file and the database, if the primary key does not exist in the flat file array then print out the results from a select statement. If the primary key does exist but the other fields do not exist then print out the results from a select statement. This is the best thing i can think of, however it seems inefficient.

Is there a better way to do this? I am using Java to do this.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T14:45:21+00:00Added an answer on May 23, 2026 at 2:45 pm

    Since you’re already comparing against a database, why not just do it all in SQL? Upload the contents of the file into the database, find the two complements (A minus B and B minus A) and export to another file. Something like:

    SPOOL diff.txt
    SELECT * FROM flatfile_table
    MINUS
    SELECT * FROM db_table
    UNION
    SELECT * FROM db_table
    MINUS
    SELECT * FROM flatfile_table
    ORDER BY SortCriteria;
    SPOOL OFF
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My goal is to have a CMS that is totally self-contained like a flat-file
I have a flat file source from Excel that has a structure like this:
I have a flat-file schema that has a header and detail records. It looks
Essentially, I have to get a flat file into a database. The flat files
I have a flat data file that I need to import into my SQL
I have a Flat File Source that reads data from a file with two
I have a txt file that I’m trying to import as flat file into
Say I have a text file that looks like this: date 1/1/2010 a,b,c a,b,d
I am supporting an ETL process that transforms flat-file inputs into a SqlServer database
I have a flat file database (yeah gross I know - the worst part

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.