Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 219
  • Last Modified:

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

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
rhservan
Asked:
rhservan
  • 2
3 Solutions
 
Jim HornMicrosoft SQL Server Developer, Architect, and AuthorCommented:
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
 
rhservanAuthor Commented:
Since there is no default cursor then what gives rise to need a cursor?
0
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
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
 
Jim HornMicrosoft SQL Server Developer, Architect, and AuthorCommented:
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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now