CTE multiple in a stored procedure

  • I have a developer wrote code using a lot of CTEs in a stored procedure.

    Basically, one CTE call another CTE call another CTE.

    CTE is sometimes easy to understand, but if using many I lose of track in the middle, and need keep going back to see what the field means, and it is hard to debug for some data issues.

    Any recommendation to debug or run some test cases for a stored procedure that may use serveral CTEs.

    Thanks,

  • sqlfriends (9/16/2016)


    I have a developer wrote code using a lot of CTEs in a stored procedure.

    Basically, one CTE call another CTE call another CTE.

    CTE is sometimes easy to understand, but if using many I lose of track in the middle, and need keep going back to see what the field means, and it is hard to debug for some data issues.

    Any recommendation to debug or run some test cases for a stored procedure that may use serveral CTEs.

    Thanks,

    Quick suggestions, have a look at Using Comments to Quickly Test CTEs[/url] by Carl P. Anderson and then this list of CTE related articles on this site

    😎

  • Thank you, the test using comments is a good one

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply