Reply to Re: Need to convert cursor

Your name:

Reply:


Posted by Erland Sommarskog on 12/11/06 22:43

Patti (pdavis269@worldsavings.com) writes:
> This was a great suggestion, thank you. I've actually been playing
> with the code because right now it inserts every record from the
> tblALPSLoans table into the tblinjectloans table for each auditor. But
> I need it to insert just enough records for each auditor until the
> percentage number for that auditor is met. So, for example, if auditor
> A has 1 record in the tblInjectLoans table and his percentage number
> (lnkeycount from @tempb from my original code) is 3, then I need to
> insert only 2 more records from the tblALPSLoans table into
> tblInjectLoans. I was playing with Top N, but that isn't working for
> me. Hopefully, this makes sense. Any ideas would be much appreciated.

So does the original code you posted produce the correct result or
not? This is not clear to me.

A good idea for this type of questions, is that you post:

o CREATE TABLE statements for your tables, preferrably simplified to
the pertinent columns.
o INSERT statement with sample data.
o The desired result given the sample.

This make it easy to copy and paste and develop a tested solution. Also
the test data helps to clarify the verbal resitriction.

Note that the amount of sample data can be fairly small, but it should
be big enough to cover important cases.

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

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