Forum Discussion
HELJEEVE
Oct 27, 2023Copper Contributor
CONCURRENCY IN SQLSERVER
MY BETOPTIONS TABLE DESIGN ID COUNT 1 100 2 200 3 45 4 2 LIKE THIS MY STORED PROCEDURE IS LIKE THIS CREATE PROCEDURE BUYLOTTOGAME BEGIN TRANS SELECT @COUNT=COUNT FROM TABLENAME WIT...
olafhelper
Nov 01, 2023Bronze Contributor
HELJEEVE , what could case here a deadlock and why do you expect one?
A deadlock can only occur if two or more process accesses two or more resources and this in different order; that's here not the case.
- HELJEEVENov 04, 2023Copper Contributorhere concurrent transaction will trying to update the same row, that's why i am using WITH UPLCOK IN SELECT STATEMENT ,JUST LIKE FOR UPDATE OF in ORACLE. So when one transaction acquire a lock on a row , next transaction will wait till current transaction COMMITS THE TRANSACTION.
IN SQL SERVER 2005 THIS WAS WORKING PERFEECTLY EVEN WITH MORE TRANSACTIONS
THERE IS ONE MORE COLUMN IN THE TABLE
TIMESTAMP.
IN 2019 LOTS OF DEADLOCK IS COMMING WHEN USING THIS UPDLCOK
ANY SUGGESTION ON THIS
THANK YOU- olafhelperNov 06, 2023Bronze Contributor
HELJEEVE wrote:
here concurrent transaction will trying to update the same rowHELJEEVE , that will never cause a deadlock, only a wait until the transaction finished; and for a single (same) row you don't need a complexe transaction handle, implicit transactions will be quite enough.
- HELJEEVENov 07, 2023Copper ContributorSO WHY FOR UPDATE OF CLAUSE IS USED IN ORACLE