| Author |
Topic  |
|
|
benildusmuerling
Yak Posting Veteran
Australia
81 Posts |
Posted - 06/21/2012 : 23:32:57
|
Thanks for reading this post, can someone help me in helping what would be the cause of this error
'Msg 16915, Level 16, State 1, Line 513 A cursor with the name 'cur_distSummary' already exists. Msg 16905, Level 16, State 1, Line 517 The cursor is already open. Msg 16943, Level 16, State 4, Line 518 Could not complete cursor operation because the table schema changed after the cursor was declared.'
Thanks
AB |
|
|
visakh16
Very Important crosS Applying yaK Herder
India
47189 Posts |
Posted - 06/21/2012 : 23:37:19
|
its obvious. check if you've explicitly closed the cursor
------------------------------------------------------------------------------------------------------ SQL Server MVP http://visakhm.blogspot.com/
|
 |
|
|
madhivanan
Premature Yak Congratulator
India
22461 Posts |
Posted - 06/22/2012 : 08:40:10
|
Also what are youdoing with the cursor?
Madhivanan
Failing to plan is Planning to fail |
 |
|
|
benildusmuerling
Yak Posting Veteran
Australia
81 Posts |
Posted - 06/24/2012 : 19:43:09
|
Hi All,
Can anyone tell me if I replace a cursor to another loop like (while exists select id from table), would this immensely improve performance.
Thanks,
AB |
 |
|
|
xhostx
Constraint Violating Yak Guru
USA
261 Posts |
Posted - 06/29/2012 : 09:32:24
|
quote: Originally posted by benildusmuerling
Hi All,
Can anyone tell me if I replace a cursor to another loop like (while exists select id from table), would this immensely improve performance.
Thanks,
AB
Performance wise: Cursors are most likely to be avoided unless needed. Also, in SQL cursors has status to check if there's more data to pass to be treated inside the while loop.
Try to take out not needed statements to improve the performance, and look at your execution plans. luck,
-------------------------- Get rich or die trying -------------------------- |
 |
|
|
DKnight
Starting Member
1 Posts |
Posted - 11/28/2012 : 13:25:51
|
Don't forget that in addition to closing the cursor you need to DEALLOCATE the cursor.  |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
India
47189 Posts |
Posted - 12/02/2012 : 02:39:43
|
quote: Originally posted by benildusmuerling
Hi All,
Can anyone tell me if I replace a cursor to another loop like (while exists select id from table), would this immensely improve performance.
Thanks,
AB
One thing to consider is why do you need to go for row by row processing and why cant you implement it in set based manner? Set based solution would be in most cases the fastest solution to implement
------------------------------------------------------------------------------------------------------ SQL Server MVP http://visakhm.blogspot.com/
|
 |
|
|
Howard43Willard
Starting Member
USA
8 Posts |
Posted - 12/02/2012 : 20:21:46
|
Could not complete cursor operation because the table schema changed after the cursor was declared.





 |
Edited by - Howard43Willard on 12/02/2012 20:27:01 |
 |
|
| |
Topic  |
|