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

    USE [EtownDB]
    GO
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    create PROCEDURE InsWxqunfaChildtb
    @logid int,
    @sql text --需要分割的字符串
    AS
    set @sql = replace(@sql,' ','')
    DECLARE @Run bit --继续循环的标志
    declare @dotIndex as int
    declare @tablename as varchar(100)
    set @Run = 1
    begin
    set nocount on
    set xact_abort on
    begin try
    begin tran
    while(@Run = 1)
    BEGIN
    if(len(@sql)>0)--如果表名集合还不为空,则进行一下操作
    begin
    set @dotIndex=CharIndex(',',@sql)
    if(@dotIndex = 0)--如果没有找到',' 证明 @sql
    begin
    set @tablename = @sql

    set @Run=0
    end;
    else
    begin
    set @tablename = substring(@sql,1,@dotIndex-1) --表名
    set @sql=substring(@sql,@dotIndex+1,len(@sql)) --把存储表名的串的长度缩短至后一个
    end;
    insert into wxqunfa_wxno(weixin,logid) values(@tablename,@logid)
    end;
    END
    commit tran
    return 1;
    end try
    begin catch
    if xact_state()=-1
    rollback tran;
    return 0;
    end catch
    end

  • 相关阅读:
    Shooting Algorithm
    Subgradient Algorithm
    Factorization Machine
    支持向量机
    Hashing Trick
    Science上发表的超赞聚类算法
    Contractive Auto-Encoder
    Shell之数学计算
    牛顿方法(Newton-Raphson Method)
    泊松回归(Poisson Regression)
  • 原文地址:https://www.cnblogs.com/mili3/p/3759149.html
Copyright © 2011-2022 走看看