Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Many sub-queries from db table vs table var

Author  Topic 

mmccardle
Starting Member

43 Posts

Posted - 2011-05-13 : 14:50:35
I have a report with 52 sub-queries, each of these queries inserts a value in a table variable based on a range of dates (per month, per year values in a different column). It only takes 9 seconds to run, however I'm wondering if from a good practice standpoint I should copy these records into a table variable first and do my number crunching from there, instead of hitting the database table directly.

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2011-05-13 : 15:47:26
It's really hard to answer your question without actually seeing the code.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page
   

- Advertisement -