sql server - What's the meaning of this SQL statement? -
i new sql transction. what's meaning of following statement?
begin tran -- xlock transaction if exists (select 1 dbo.activetransaction (xlock) transactionid = @transactionid) begin (omitted) end commit tran
thanks!
what's happening here is:
- a sql transaction begun
- you check see if
dbo.activetransaction
table contains recordtransactionid
equal alue in variable @transactionid.- if yes, "(omitted)" code
- any changes made commit'ed database
the 'xlock' means that:
specifies exclusive locks taken , held until transaction completes. if specified rowlock, paglock, or tablock, exclusive locks apply appropriate level of granularity.
Comments
Post a Comment