• chadmack (4/30/2013)


    Thanks to everyone so far, Code is over 9000 lines in its entirety.

    This appears to be a data issue. The data in moveitems.description is getting tuncated, this is causing errors when looking for the char(13) line separators.

    Check the ddl for table MYOB_IMPORT..MOVEITEMS, the [description] string you posted is around 244-258 characters.

    That sproc could be easily rewritten to be far simpler, more reliable and set-based, using delimitedsplit2k8 separating on char(13) instead of all the confusing string arithmetic.

    “Write the query the simplest way. If through testing it becomes clear that the performance is inadequate, consider alternative query forms.” - Gail Shaw

    For fast, accurate and documented assistance in answering your questions, please read this article.
    Understanding and using APPLY, (I) and (II) Paul White
    Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden