I have a stored procedure which is having multiple cursors. These cursors are
affecting the performance of SP.
With SQL Server 2005 we can write the SP in C#. If I replace those cursors
with for/while loop of C# code then will there be any performance benefit
with it?
Can anybody tell me what internally happens when we write code in C#? How it
process the C# code?
Atul Sureka
Uri Dimant - 16 Jul 2008 10:33 GMT
Hi
> With SQL Server 2005 we can write the SP in C#. If I replace those cursors
> with for/while loop of C# code then will there be any performance benefit
> with it?
Have you tried it?
> Can anybody tell me what internally happens when we write code in C#? How
> it
> process the C# code?
It is SQL Server forum, you will better of to ask in C# newsgroup
>I have a stored procedure which is having multiple cursors. These cursors
>are
[quoted text clipped - 9 lines]
>
> Atul Sureka
Gert-Jan Strik - 20 Jul 2008 13:38 GMT
> I have a stored procedure which is having multiple cursors. These cursors are
> affecting the performance of SP.
[quoted text clipped - 7 lines]
>
> Atul Sureka
Atul,
I don't have the answers to your questions. However, if multiple cursors
give you unsatisfactory performance, then I would suggest you eliminate
some or all of the cursors, and replace them with a set based solution.
Set based solutions are typically orders of magnitude faster than
equivalent cursor approaches.
If there is performance benefit in rewriting the T-SQL code in C#, I
would expect the difference to be marginal (at least in comparison with
a set based approach).

Signature
Gert-Jan
SQL Server MVP