zoukankan      html  css  js  c++  java
  • 存储过程事务

    --
    ALTER PROCEDURE [dbo].[tb_ADD]
    @a int,
    @b(20),

     AS
        BEGIN
            
            --开始事务
            begin tran
            if  exists(select ID from tbwhere a=@a and b=@b )
                begin
                    rollback tran
                    return -1--该记录已存在.
                end


            INSERT INTO [tb]( [a],[b] )VALUES(@a,@b    )

            IF @@error <> 0
                BEGIN
                    rollback tran
                    return 0--失败
                END
            else
                begin
                    commit tran
                    return 1    --成功
                end
        END

  • 相关阅读:
    flush logs
    slave-skip-errors,sql_slave_skip_counter
    稀饭
    table
    profiles
    索引使用规范
    innodb_rollback_on_timeout
    mysql账号管理
    跨库复制
    linux.sh
  • 原文地址:https://www.cnblogs.com/smallfa/p/1740169.html
Copyright © 2011-2022 走看看