• daniness (7/17/2013)


    The columns that are in the order by: ClaimId, LineNum, EncounterLineNum, EncounterType, and InternalICN. These make up the primary key that results of both queries are being inserted into in the stored procedure. Please let me know if I can further clarify. Thanks.

    Like I said earlier, tweaking this query to get it through the PK error is a trivial matter - but isn't it a bit pointless if you don't know whether or not the output is actually correct?

    “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