Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL record locking and transactions
Message
De
12/03/2004 08:28:34
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00874330
Message ID:
00885560
Vues:
19

You're incorrect in your assumptions and there's no need to guess.
I would recomend you to read the book Inside SQL Server 2000 by Kalen Delaney which explains in details how SQL Server works.


Yes, SQL have RID locks, but on a table without a index the lock mechanism is not usable, because
i cannot use RIDs on T-SQL.

Open SQL Analyzer, create 2 connections, run this code
-- session 1
USE tempdb
CREATE TABLE myTestHeap		(myField INT,f2 int)
INSERT INTO myTestHeap VALUES (1,1)
INSERT INTO myTestHeap VALUES (2,2)
INSERT INTO myTestHeap VALUES (3,3)
INSERT INTO myTestHeap VALUES (4,4)
BEGIN TRAN
-- next set a rid lock
SELECT * FROM tempdb.dbo.myTestHeap (UPDLOCK,ROWLOCK) WHERE myField=1

-- session 2 is locked
UPDATE tempdb.dbo.myTestHeap set myField=5  WHERE myField=2
-- now Kill Session 2

-- session 1 release
sp_lock -- you can see the RID lock
rollback
DROP TABLE myTestNoCluster
On SQL Server,
if a developer want control the lock,
it must use on the where/on clause a expression that not try to use a RID lock on two session.
Explain all cause of this is hard for me with my english level.

If you can found a example where i can control row lock without a KEY lock, i thank you a lot,
otherwise, on esplicit developer lock context i'm correct.

Fabio
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform