Sunday, February 19, 2012

avoid cursors.

hi what are ways of avoiding cursors?
my boss told me to use derived tables. any other tricks i can use?"ichor" <ichor@.hotmail.com> wrote in message
news:OyNAbw33FHA.3592@.TK2MSFTNGP12.phx.gbl...
> hi what are ways of avoiding cursors?
> my boss told me to use derived tables. any other tricks i can use?
>
It's usually a good idea to avoid cursors and mostly they are unnecessary.
For most data manipulation problems you can achieve the same thing as a
cursor by using set based code (code that operates on the entire set of data
at once rather than one row at a time). There is no single set based
technique to replace a cursor because cursors don't represent a particular
class of problem, they are just one tool with which to solve problems.
David Portas
SQL Server MVP
--|||Read up in SQL Server Books Online on topics like temporary tables,
subqueries, and use of the Case function. These can be used to replace
cursor based programming that performs complex row selection or updates.
"ichor" <ichor@.hotmail.com> wrote in message
news:OyNAbw33FHA.3592@.TK2MSFTNGP12.phx.gbl...
> hi what are ways of avoiding cursors?
> my boss told me to use derived tables. any other tricks i can use?
>

No comments:

Post a Comment