Solved

Is there a default cursor used when building a stored procedure?

Posted on 2013-02-07
4
209 Views
Last Modified: 2013-02-07
If so what is the name of the default cursor?
If so does the default cursor require syntax?
Is there someplace where a default cursor would be assigned?
0
Comment
Question by:rhservan
  • 2
4 Comments
 
LVL 65

Assisted Solution

by:Jim Horn
Jim Horn earned 200 total points
Comment Utility
Never heard of a 'default' cursor, so that would make the answer to all three questions no.
Having said that, most T-SQL I've seen that uses cursors names them <pause for effect>  cur.
0
 

Author Comment

by:rhservan
Comment Utility
Since there is no default cursor then what gives rise to need a cursor?
0
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 300 total points
Comment Utility
usually, people use cursors when they (think they) cannot do it in a single SQL statement.
there are indeed situations where you need to handle 1 row at a time (for example, sending emails based on a query)
however, still a non-cursor solution is then possible and almost always better performîng ...
0
 
LVL 65

Assisted Solution

by:Jim Horn
Jim Horn earned 200 total points
Comment Utility
A cursor is a loop through a defined recordset, and is used when you need individual logic to deal with individual rows in your recordset that isn't real conducive to do in set-wide statements.

The term 'default' has no meaning when used as 'default cursor' that I'm aware of.
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

After restoring a Microsoft SQL Server database (.bak) from backup or attaching .mdf file, you may run into "Error '15023' User or role already exists in the current database" when you use the "User Mapping" SQL Management Studio functionality to al…
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

763 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now