Formatting notes using GP econnect

Note to self:

http://dynamicsgpland.blogspot.co.uk/2010/11/formatting-notes-using-econnect-2010.html

My solution is to run in a stored procedure after econnect,

-- fix formatting of the notes field that gets screwed up by econnect loosing line breaks     
UPDATE  sy03900
    SET txtfield = replace(CAST (txtfield AS VARCHAR (MAX)), CHAR(10), char(13))
WHERE   noteindx = (SELECT NOTEINDX
                    FROM   rm00101
                    WHERE  custnmbr = @CUSTNMBR);
UPDATE  sy03900
    SET txtfield = replace(CAST (txtfield AS VARCHAR (MAX)), CHAR(10), char(13))
WHERE   noteindx = (SELECT NOTEINDX
                    FROM   sop10100
                    WHERE  soptype = @SOPTYPE
                           AND sopnumbe = @SOPNUMBE);