Link to home
Create AccountLog in
Avatar of rhservan
rhservanFlag for United States of America

asked on

Are using cursors still best practice? Please elaborate and what should be used if not?

I am an SSRS report writer and have not used cursors much at all in my queries and procs.
However,  I am in an environment where cursors were heavily used. Am I missing something?
SOLUTION
Avatar of Patrick Matthews
Patrick Matthews
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
SOLUTION
Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
Avatar of rhservan

ASKER

This link is very helpful in rewriting cursors:

http://wiki.lessthandot.com/index.php/Cursors_and_How_to_Avoid_Them
SOLUTION
Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
This is what I have gathered so far based on the above responses.

So the topic of using SET or CURSOR is foreign to me, I am not an SQL Server expert, I just happened to be thrown in an environment where previous report writer used cursors everywhere.  Based on what I have read here so far I am better off not writing new report code as cursors.

I have been performing SSRS report writing in various environments.  I usually create a stored procedure with parameters then I use what I consider to be standard TSQL commands to create my datasets. Example: Select,  Joins, Unions, Case,etc.......

I want to begin the new reports without using cursors and use as discussed in the previous sentence.  I may come back and try to convert the older cursor based reports at a later time.

Please correct anything I may be misunderstanding here. Thx
ASKER CERTIFIED SOLUTION
Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.