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

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -