zoukankan      html  css  js  c++  java
  • sqlserver sp模板

    某公司内部的sp模板

    create procedure [usp_my_procedure_name]
    as
    begin
        set nocount on;
        declare @trancount int;
        set @trancount = @@trancount;
        begin try
            if @trancount = 0
                begin transaction
            else
                save transaction usp_my_procedure_name;
    
            -- Do the actual work here
    
    lbexit:
            if @trancount = 0
                commit;
        end try
        begin catch
            declare @error int, @message varchar(4000), @xstate int;
            select @error = ERROR_NUMBER(), @message = ERROR_MESSAGE(), @xstate = XACT_STATE();
            if @xstate = -1
                rollback;
            if @xstate = 1 and @trancount = 0
                rollback
            if @xstate = 1 and @trancount > 0
                rollback transaction usp_my_procedure_name;
    
            raiserror ('usp_my_procedure_name: %d: %s', 16, 1, @error, @message) ;
        end catch
    end

    尾部

  • 相关阅读:
    grep 精确匹配
    @ARGV
    同时查看多个文件
    R画双y轴图
    R画饼图
    linux的sort排序
    $0
    QQ图
    Config::Std模块安装
    R语言做正态分布检验
  • 原文地址:https://www.cnblogs.com/theonewu/p/4045277.html
Copyright © 2011-2022 走看看