I have a database that is about 400 gigs. The majority of the space is consumed by images of utility bills stored in string form as varchar(max)
in a single table. It's a poor database design that I inherited. I have already exported the utility bills as pdfs to a network folder. Now I am trying to replace the images in the database with an empty string. I have been updating in small batches of 40k to 80k records at a time. The problem is that after a few batches, the table gets corrupted. I'll get a message that the update failed. When I run CHECKDB I get
Msg 8909, Level 16, State 1, Line 1 Table error
It's happened twice so far and I have to restore the database from a backup.
I need to know why this is happening and if there is a way to avoid it. I'm doing this in a test environment and I need to get this problem figured out before I can work on the production database.
Thank you for your help.
Edit: Changed binary to string. One of the images is stored as a continuous string of 65,535 characters.
Edit: This is happening on MSSQL 2014 SP3 (Version 12.0.6024.0)
DBCC CHECKDB
before the update to rule out existing corruption?