You are here: Re: Run query based on values in another table « MsSQL Server « IT news, forums, messages
Re: Run query based on values in another table

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация