|
Posted by Erland Sommarskog on 03/30/07 21:33
bubbles (bubbles.one@hotmail.com) writes:
> 05. Using the product list, run queries against tblCalls such that
> the following analyses are generated into different tables
> (tables created on the fly).
>
> Each product will cause about 20 tables to be created (deleted
> and re-created at each run of the job) with various analyses.
>
> Question:
> 1. Is this a good strategy?
> 2. How to achieve this in TSQL?
If the table indeed have different layout depending on product, you
would indeed have to loop, for instance using a cursor as you discovered.
But if all sets of tables have the same layout, you should probably have
one single set of tables instead, and in this case there would not be any
need for loops.
--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
Navigation:
[Reply to this message]
|