Is T-SQL Stored Procedure Execution 'atomic'?

后端 未结 5 1898
甜味超标
甜味超标 2021-01-04 01:16

Let\'s say I have a simple stored procedure that looks like this (note: this is just an example, not a practical procedure):

CREATE PROCEDURE incrementCounte         


        
5条回答
  •  盖世英雄少女心
    2021-01-04 01:55

    I use this method

    CREATE PROCEDURE incrementCounter
    AS
    
    DECLARE @current int
    
    UPDATE MyTable
    SET
      @current = CounterColumn = CounterColumn + 1
    
    Return @current
    

    this procedure do all two command at one time and it is isolate from other transaction.

提交回复
热议问题