Error during the transfer of a file from the database to the hard drive

Description

The server log is showing this error:

The offset and length specified in the READTEXT statement is greater than the actual data length of 0

A file cannot be correctly transferred from the database to your hard drive, if this error occurs.

Version

All versions of eWay-CRM

Difficulty

High

Resolution

The error is caused by emails or documents that weren't completely uploaded and have stayed in this situation. You can find out by this command in the SQL database:

SELECT * FROM EWD_BinaryData WHERE (CASE IsCompressed WHEN 0 THEN FileSize ELSE CompressedSize END) <> UploadedSize

If there are any of these incomplete files, you need to identify whether they are emails or documents. Use these two different commands:

SELECT * FROM EWD_Emails WHERE ItemGUID = 'XXX'
SELECT * FROM EWD_Documents WHERE ItemGUID = 'XXX'

Now, you need to find out whether these emails or documents are still able and can be transferred again, or whether you need to delete them. If so, you need to delete them both in the EWD_Emails or EWD_Documents table and in the EWD_BinaryData table.