Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
JohnCash1
Starting Member
39 Posts |
Posted - 2012-09-18 : 21:16:16
|
| Hi, Could someone explain to me what is a SQL cursor, what it does, and how to use it. Could you provide a simple example. Thank you, appreciate it. |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2012-09-18 : 21:29:37
|
| If you really must know: http://msdn.microsoft.com/en-us/library/ms191179%28SQL.90%29.aspxCursors are best avoided in SQL Server. Row-by-row access slows performance and often creates lengthy/bloated code compared to regular SQL statements. |
 |
|
|
Vishal_sql
Posting Yak Master
102 Posts |
Posted - 2012-09-18 : 21:44:05
|
| I agree robvolk.When you have large dataset , the performance is harmed by cursor.but you can still know the cursorhttp://blog.sqlauthority.com/2007/01/01/sql-server-simple-example-of-cursor/ |
 |
|
|
JohnCash1
Starting Member
39 Posts |
Posted - 2012-09-18 : 21:46:09
|
| cool, thanks for the info and suggestions. So do you mean that I don't need cursor at all and anything that cursor does or is use by cursor can be done with SQL statements? |
 |
|
|
Vishal_sql
Posting Yak Master
102 Posts |
|
|
JohnCash1
Starting Member
39 Posts |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
|
|
|
|
|