?
Solved

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

Posted on 2013-02-07
4
Medium Priority
?
215 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
[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
  • 2
4 Comments
 
LVL 66

Assisted Solution

by:Jim Horn
Jim Horn earned 800 total points
ID: 38865702
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
ID: 38865751
Since there is no default cursor then what gives rise to need a cursor?
0
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 1200 total points
ID: 38865760
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 66

Assisted Solution

by:Jim Horn
Jim Horn earned 800 total points
ID: 38865763
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

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

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

This is basically a blog post I wrote recently. I've found that SARGability is poorly understood, and since many people don't read blogs, I figured I'd post it here as an article. SARGable is an adjective in SQL that means that an item can be fou…
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…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

770 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