4 ms·
The trick is to change the name of the CTE in your final select. This will allow you to inspect that particular step. This works as long as your CTE’s are corr
by Bootvis 4y ago
The trick is to change the name of the CTE in your final select. This will allow you to inspect that particular step.
This works as long as your CTE’s are correct SQL and only the logic is wrong or suspect.
- Ntrails 4y agoI guess the point is you could just stick the results of each step that is currently a CTE into #table as separate queries, and you're only doing the work once to step through the stages? From a debug point of view that feels more convenient to _me_.
- Bootvis 4y agoI guess it depends, materialising all the steps might be slow and you might need to do a refactor to get a CTE-based query. If you want just want to check a few (maybe changing) records because you expect problems there a final select with an appropriate where is probably faster. Edit: also I don’t like to leave a mess behind and CTE’s don’t require cleaning up afterwards.