?
Solved

alternative to cursors

Posted on 2005-04-20
2
Medium Priority
?
229 Views
Last Modified: 2010-03-19
hi, is their another alternative to cursors?

as i've experienced, cursor can be:
- slow when it is declared for a select with lots of records
- stored procedures using cursors cannot be run at the same time by diff clients, 'cursor already open' error is detected
0
Comment
Question by:3Mann
2 Comments
 
LVL 28

Accepted Solution

by:
rafrancisco earned 600 total points
ID: 13830678
>> stored procedures using cursors cannot be run at the same time by diff clients, 'cursor already open' error is detected <<

To avoid the 'cursor already open' error, declare your cursor as local cursors like this:

DECLARE cTables CURSOR LOCAL FOR

Creation/use of temporary tables can be alternatives to cursors.
0
 
LVL 1

Author Comment

by:3Mann
ID: 13830824
i havent used the LOCAL keyword.
thanks for the info

http://www.sql-server-performance.com/cursors.asp
0

Featured Post

Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

Question has a verified solution.

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

It is possible to export the data of a SQL Table in SSMS and generate INSERT statements. It's neatly tucked away in the generate scripts option of a database.
This month, Experts Exchange sat down with resident SQL expert, Jim Horn, for an in-depth look into the makings of a successful career in SQL.
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 set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.
Suggested Courses

831 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