You have a stored procedure that uses a cursor. The stored procedure updates several related tables. You discover that the stored procedure runs slowly and uses a significant amount of resources on the database server. You need to recommend changes to the stored procedure to meet the following requirements:
* Minimize execution time
* Minimize development effort
* Minimize server resource requirements
What should you recommend?
A.
Change the cursor to a dynamic cursor.
B.
Change the cursor to a client-side cursor.
C.
Rewrite the cursor by using set-based operations.
D.
Rewrite the cursor by using recursive CLR stored procedure.
Explanation:
If possible, avoid using SQL Server cursors. They generally use a lot of SQL Server resources and reduce the performance and scalability of your applications.