November 12, 2007 at 11:24 am
I (User A) have a cursor in which i am selecting records from a table A. While this cursor is getting executed, someone else (user B) is trying
to read/write data from the same table A. Will the cursor lock the table and not allow user B to read/write from table A?
Do i need to write cursor in some unique way so that user B can access Table A while user A is performing cursor operations on Table A?
Thanks,
Ramesh.
November 12, 2007 at 2:12 pm
Declare the cursor LOCAL FORWARD_ONLY STATIC READ_ONLY if thats all User A needs - refer to DELCARE CURSOR options in BOL - http://technet.microsoft.com/en-us/library/ms180169.aspx
Tommy
Follow @sqlscribeNovember 12, 2007 at 6:18 pm
Yes... you need to write it in a "special" way... without a cursor! 😉
--Jeff Moden
Change is inevitable... Change for the better is not.
November 19, 2007 at 2:05 pm
I second Jeff - rewrite the code to not use a cursor at all. Failing this, wouldn't a FAST_FORWARD cursor be best with NOLOCKs in the SELECT?
Best,
Kevin G. Boles
SQL Server Consultant
SQL MVP 2007-2012
TheSQLGuru on googles mail service
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply