title: What are the advantages/disadvantages of using a CTE?
body: <p>I'm looking at improving the performance of some SQL, currently CTEs are being used and referenced multiple times in the script. Would I get improvements using a table variable instead? (Can't use a temporary table as the code is within functions).</p>