Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Fastforward cursor and updlock Expand / Collapse
Author
Message
Posted Friday, April 26, 2013 7:09 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Tuesday, July 9, 2013 9:00 PM
Points: 3, Visits: 7
Hi,

Can I use UpdLock hint with fastforward cursor together? From the discussion below, it seems fastforward cursor cannoe update and delete data?

Thanks,
Post #1446956
Posted Friday, April 26, 2013 7:19 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Friday, September 12, 2014 9:43 AM
Points: 7,284, Visits: 13,824
It's highly likely that the folks here can replace your cursor-based code with a fast, efficient and pretty set-based equivalent - why don't you post your code and let them try? There's a good reason for this. If you are experiencing locking/blocking problems with a slow loop-based process then replacing it with a super-fast set-based version will help and may even eliminate the problem.

“Write the query the simplest way. If through testing it becomes clear that the performance is inadequate, consider alternative query forms.” - Gail Shaw

For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
Exploring Recursive CTEs by Example Dwain Camps
Post #1446975
Posted Friday, April 26, 2013 7:32 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Tuesday, July 9, 2013 9:00 PM
Points: 3, Visits: 7
Sorry, forgot post the link
http://www.geekinterview.com/question_details/16802
Post #1446990
Posted Friday, April 26, 2013 7:34 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Tuesday, July 9, 2013 9:00 PM
Points: 3, Visits: 7
Thanks Chris. Actually I am not facing any blocking issue, just try to understand the cursor and locking mechanisim in SQL Server.
Post #1446992
Posted Friday, April 26, 2013 7:36 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Friday, September 12, 2014 9:43 AM
Points: 7,284, Visits: 13,824
Oh right - ok. In that case, I'll try to track down an excellent article which provides good evidence NOT to use built-in cursor updates but to do it manually instead...

Edit: Here it is.


“Write the query the simplest way. If through testing it becomes clear that the performance is inadequate, consider alternative query forms.” - Gail Shaw

For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
Exploring Recursive CTEs by Example Dwain Camps
Post #1446994
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse