Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Performance Procedure

Posted on 2013-01-26
6
Medium Priority
?
236 Views
Last Modified: 2013-01-27
I can win performance on sql server stored procedure. I need use cursor with fast_forward or while @@rowcount>0 i improve most performance?
0
Comment
Question by:fsouza
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 39

Expert Comment

by:Aaron Tomosky
ID: 38823126
A cursor is usually the slowest way to do anything. Can you please post what you are trying to do?
0
 
LVL 5

Expert Comment

by:RehanYousaf
ID: 38823306
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
 
LVL 6

Accepted Solution

by:
esolve earned 1000 total points
ID: 38823540
0
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 

Author Comment

by:fsouza
ID: 38824177
The correct use is CURSOR LOCAL FAST_FORWARD or CURSOR FAST_FORWARD ???
0
 
LVL 5

Expert Comment

by:RehanYousaf
ID: 38824313
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
 
LVL 75

Assisted Solution

by:Anthony Perkins
Anthony Perkins earned 1000 total points
ID: 38824321
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

Featured Post

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
What if you have to shut down the entire Citrix infrastructure for hardware maintenance, software upgrades or "the unknown"? I developed this plan for "the unknown" and hope that it helps you as well. This article explains how to properly shut down …
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question