In Chapter 2, we went ahead and documented a stored procedure used to call data for a report. The proc was called dailySummaryReportByMonth. Let’s review the documentation from Chapter 2; then we can start to rewrite the stored procedure. When we look at the data calls, we see six calls to the dbo.Posts table. There’s a good chance we can reduce the number of calls to that table. The proc also uses both a temporary table and a table variable.
Temporary Tables vs. Table Variables
There is a lot of debate between whether to use table variables or temporary tables. There can be issues ...