JPEG Markers Corrupted

I have database A with an nvarchar(max) column containing images. The data was copied to database B with Sql Data Compare. Both columns are SQL_Latin1_General_CP1_CI_AS collation. When I save the data to a file from each database and compared using beyond compare, the image in database b had an invalid jpeg marker but otherwise beyond compare was able to display the image.

Looking at the data in SSMS, the first character of the good image starts with a box while the bad image first character starts with a diamond.

When I compare the two tables with SQL Data Compare, at first no differences were seen. When I set the comparison to use binary collation, then differences were seen, but when I updated database b, the first character remained a diamond instead of a box. When Sql Data Compare displays the side by side data, both columns show a diamond as the first character rather than showing a box for the column from database A.

For some reason Sql Data Compare is not correctly reading the data from the database during its comparison.

I used SSMS to update the data in database b and the images are all fine.


  • Options
    Hi Richard,

    Are you using the tool to sync or generating a script and then syncing via SSMS?

    It sounds like it could be an encoding issue.

    You may want to try changing the encoding of the deployment scripts in your Application options.

    Located in Tools -> Application options

    I am not really sure which encoding option you will have to select so you may need to try each one to see if you get a better result.

    Manfred Castro
    Product Support
    Red Gate Software
Sign In or Register to comment.