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 |
benildusmuerling
Yak Posting Veteran
81 Posts |
Posted - 2012-06-21 : 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 513A cursor with the name 'cur_distSummary' already exists.Msg 16905, Level 16, State 1, Line 517The cursor is already open.Msg 16943, Level 16, State 4, Line 518Could not complete cursor operation because the table schema changed after the cursor was declared.'ThanksAB |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-06-21 : 23:37:19
|
its obvious. check if you've explicitly closed the cursor------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2012-06-22 : 08:40:10
|
Also what are youdoing with the cursor?MadhivananFailing to plan is Planning to fail |
|
|
benildusmuerling
Yak Posting Veteran
81 Posts |
Posted - 2012-06-24 : 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
277 Posts |
Posted - 2012-06-29 : 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 Post |
Posted - 2012-11-28 : 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
52326 Posts |
Posted - 2012-12-02 : 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 MVPhttp://visakhm.blogspot.com/ |
|
|
Howard43Willard
Starting Member
8 Posts |
Posted - 2012-12-02 : 20:21:46
|
Could not complete cursor operation because the table schema changed after the cursor was declared. |
|
|
|
|
|
|
|