Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL record locking and transactions
Message
De
04/03/2004 14:51:00
 
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:
00883225
Vues:
17

Will utilize the Rowlock only if ShipperID is indexed?


SQL Server, if a table donnot have a cluster index,
it implement a default cluster index.

If you mark indexed sets, the problem is simple,
but with not indexed sets you can have not immediate results:
-- Phone have 3 distinct values
-- session 1
use Northwind
begin tran
select * from dbo.Shippers (UPDLOCK,ROWLOCK)  where  Phone='(503) 555-9831'
-- session 2 is locked
use Northwind
begin tran
select * from dbo.Shippers (UPDLOCK,ROWLOCK)  where  not  Phone='(503) 555-9831'
but you can read the free rows if you skip the Phone, and use the primary index:
-- session 2 is not locked
use Northwind
begin tran
select * from dbo.Shippers (UPDLOCK,ROWLOCK)  where  not ShipperID=1'
Then, where SQL Server put the lock ?

Fabio
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform