Our ERP database (SQL2016) stores long, random length text fields as IMAGE data type. As an example, the text "LINE 35 WAS DELETED AS PER CUSTOMER." is stored in two columns, BITS (0x0D000A004C0049004E00450020003300350020005700410053002000440045004C0045005400450044002000410053002000500045005200200043005500530054004F004D00450052002E002000) and BITS_LENGTH (80).
Note, in this case, the "0D000A00" immediately following the 0x (each character is stored as four bits). This indicates that the text is preceded by a carriage return/line feed. My data (some 100,000 records) contains text fields that may have one or more leading or trailing carriage return/line feeds. I need a query that can strip out these leading/trailing carriage returns without affecting the remaining text and without affecting any carriage return/line feeds that are embedded within the text and overwrite the existing BITS and BITS_LENGTH columns accordingly.
Any assistance would be appreciated.