zoukankan      html  css  js  c++  java
  • 逐行计算、逐行递延、逐行更新

    -- 逐行计算、逐行递延、逐行更新

    declare @tb table
    (工号
    int, 姓名 nvarchar(10), 数量 int, 基数 int, 开始号 int, 终止号 int)
     
    insert @tb(工号, 姓名, 数量) select 1, N'张三', 5 
    insert @tb(工号, 姓名, 数量) select 2, N'李四', 6 
    insert @tb(工号, 姓名, 数量) select 3, N'王五', 7 

    declare @num int,@begin int,@end int
    select  @num=0
    update @tb 
    set @num=
    case when @num=0 then 100 else @end 
    end,
    @begin=@num+1, @end=@num+数量, 基数=@num, 开始号=@begin, 终止号=@end
    select * from @tb

    /*工号        姓名        数量        基数        开始号      终止号         
    ----------- ---------- ----------- ----------- ----------- ----------- 
    1           张三         5           100         101         105
    2           李四         6           105         106         111
    3           王五         7           111         112         118

    (所影响的行数为 3 行)
    */



  • 相关阅读:
    Unity Shader 之 uv动画
    c++源文件后缀名问题
    Unity Shader 之 透明效果
    正则表达式
    Unity Shader基础
    Unity Shader 之 渲染流水线
    2017/11/22 Leetcode 日记
    2017/11/21 Leetcode 日记
    2017/11/13 Leetcode 日记
    2017/11/20 Leetcode 日记
  • 原文地址:https://www.cnblogs.com/zengxiangzhan/p/1638168.html
Copyright © 2011-2022 走看看