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:

  1. a sql transaction begun
  2. you check see if dbo.activetransaction table contains record transactionid equal alue in variable @transactionid.
    1. if yes, "(omitted)" code
  3. 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

Popular posts from this blog

jQuery clickable div with working mailto link inside -

WPF: binding viewmodel property of type DateTime to Calendar inside ItemsControl -

java - Getting corefrences with Standard corenlp package -