0

I'm trying to verify data exported from MSSQL and imported into MySQL is 100% accurate using MD5 hash. On Linux, I'm using md5sum and WinMD5 on Windows. The encoding is the same: UTF8. I tried both UNICODE and ANSI, but the results were the same.

When I visually compare the data in the export files or the hashes of individual cell values, it's 100% accurate. However, comparing the two files results in different hashes. Anyone know why the hashes would be different?

Your comments are much appreciated.

UPDATE: The data is exported from MSSQL using BCP into a text (.txt) file. MySQL data is exported using: SELECT * INTO OUTFILE.... into a text file. Both use "%^&" as the field delimiter,"!@#$" as the row delimter, and escape using "\".

2
  • 1
    What files? How were they exported? For starters, the line separators consist of 2 chars on Windows and only one on Linux if you are exporting a csv or some other text file.
    – Hannah Vernon
    Apr 6, 2014 at 16:27
  • 1
    @Max - I added the information you requested. I'm not clear on line separators using 2 char vs. 1 char. I chose to separate them using something other than the default newline/return character. - Thanks for the comment. Apr 6, 2014 at 18:33

2 Answers 2

1

There can be various reasons why file hashes different:

  • Line Endings differ;
  • Spacing might differ (tabs vs spaces);
  • Different layout for same data
  • Encoding (of the file that data is saved in)
  • Quotes (single vs double)
  • Case sensitivity

What I would do, is compare both files with diff tool. git diff can come in help here as it has ability to diff word by word and if you pass it --no-index option don't even have to place them in git repository. This command can help

$ git diff --no-index --color-words file1.txt file2.txt
0
0

Use something like the comp command to find out the first place they're different.

Then open the files up in a hex editor, like HxD for Windows, and look at where they're different. In particular, look for:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.