Performance Procedure

I can win performance on sql server stored procedure. I need use cursor with fast_forward or while @@rowcount>0 i improve most performance?
fsouzaAsked:
Who is Participating?
 
Aaron TomoskyTechnology ConsultantCommented:
A cursor is usually the slowest way to do anything. Can you please post what you are trying to do?
0
 
RehanYousafCommented:
It depends on the situation ... I mostly try to avoid both ... If you explain what you want maybe we can help

P.S. Performance matters if you dealing with large amounts of data
0
The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

 
fsouzaAuthor Commented:
The correct use is CURSOR LOCAL FAST_FORWARD or CURSOR FAST_FORWARD ???
0
 
RehanYousafCommented:
correct use is to avoid both ... atleast read those articles before asking same question again...
it all depends on your scenario which you havent told us yet :-)
0
 
Anthony PerkinsConnect With a Mentor Commented:
The correct use is CURSOR LOCAL FAST_FORWARD or CURSOR FAST_FORWARD ???
If I understand you correctly the question is:

What is the difference between using the keyword LOCAL and not using it?

The answer is nothing.  They are the same.

Here is the definition from SQL Server's BOL (my emphasis):
LOCAL
Specifies that the scope of the cursor is local to the batch, stored procedure, or trigger in which the cursor was created. The cursor name is only valid within this scope. The cursor can be referenced by local cursor variables in the batch, stored procedure, or trigger, or a stored procedure OUTPUT parameter. An OUTPUT parameter is used to pass the local cursor back to the calling batch, stored procedure, or trigger, which can assign the parameter to a cursor variable to reference the cursor after the stored procedure terminates. The cursor is implicitly deallocated when the batch, stored procedure, or trigger terminates, unless the cursor was passed back in an OUTPUT parameter. If it is passed back in an OUTPUT parameter, the cursor is deallocated when the last variable referencing it is deallocated or goes out of scope.

GLOBAL
Specifies that the scope of the cursor is global to the connection. The cursor name can be referenced in any stored procedure or batch executed by the connection. The cursor is only implicitly deallocated at disconnect.

Note:  
If neither GLOBAL or LOCAL is specified, the default is controlled by the setting of the default to local cursor database option. In SQL Server version 7.0, this option defaults to FALSE to match earlier  
0
All Courses

From novice to tech pro — start learning today.