|
Posted by bubbles on 03/30/07 01:02
On Mar 29, 8:10 pm, Erland Sommarskog <esq...@sommarskog.se> wrote:
>
> First lesson in SQL: stop think in loops. The normal approach is that you
> handle all data at once as in the query that I showed you. There are
> exceptions when looping may be called for, or may be the best solution,
> but nothing you have said this far, indicates that this would be necessary.
>
> Since I don't know what the queries against TableB look like, I cannot
> assist more than with the example I provided. I forgot to mention that
> it runs in the Northwind database. (Which does not ship with SQL 2005,
> but is on SQL 2000, and can be downloaded from Microsoft.com.)
>
> --
> Erland Sommarskog, SQL Server MVP, esq...@sommarskog.se
>
> Books Online for SQL Server 2005 athttp://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books...
> Books Online for SQL Server 2000 athttp://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
Thank you for your patience.
Here is the whole deal:
01. Download tblWarrantyCalls, tblDeliveries, tblReplacements
02. Append tblReplacements to tblDeliveries
03. Merge tblWarrantyCalls, tblDeliveries into tblCalls (based on
certain criteria)
04. Generate a product list tblProducts from tblCalls
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.
These tables are then linked to front-end Microsoft Access
applications
that present the data both graphically and in the raw (if
required).
This process saves users a lot of time, as they will not need to
run queries
against a humongous database. All required analyses are already
pre-generated.
Even raw data for each product are seperated into their own
tables, so running
queries against them are much faster.
Question:
1. Is this a good strategy?
2. How to achieve this in TSQL?
Thanks!
Bubbles
[Back to original message]
|