Solved

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

Posted on 2013-02-07
4
211 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
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 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 300 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 65

Assisted Solution

by:Jim Horn
Jim Horn earned 200 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

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

     When we have to pass multiple rows of data to SQL Server, the developers either have to send one row at a time or come up with other workarounds to meet requirements like using XML to pass data, which is complex and tedious to use. There is a …
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…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

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