Reply to Re: 1 SP with dynamic input parameters and multiple rows as the source of the query

Your name:

Reply:


Posted by Erland Sommarskog on 12/04/05 20:29

serge (sergea@nospam.ehmail.com) writes:
> The major problem I have is I can't use dynamic SQL for choosing
> the three dynamic columns as the 2nd row of records would have a
> different selection of dynamic columns (at least I don't know how
> if the solution is dynamic SQL). The only solution I can think of
> looks pretty bad to me. I would use a cursor, run each row at a
> time, store a TRUE, FALSE value to stop processing or not and
> store the result in another detail table. Then if all AND
> questions have ended with TRUE do a union of all the result and
> return the common list of employees. It sounds pretty awful as an
> approach. I am hoping there's a simpler method for achieving this.

That was a long post, and I guess this is because this is a complex
problem. Or at least, I like to believe so, as I understood far from
all of it. For instance, I failed to understand why you could not use
dynamic SQL.

There was a table and some sample data for it, but I did not really
understand how it was used. Does one row describe a search? Or
does all rows with the same REPSELNO describe a search? (In such case,
should there not be a header table defining the search, and then a sub-
table with the details?) How do you describe the AND/OR thing you are
talking about?

It would certainly help to have a more concrete example where you show
some sample entries, and the exact results those examples are supposed
to give.


--
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

[Back to original 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

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