zoukankan      html  css  js  c++  java
  • 技术中心固定资产update|ok|

    涉及到的表目前有fa_card,fa_cardhistory,前者是固定资产卡片主表,后者是附表。

    我需要更改的卡片资产编码范围在:

    然后sql想写成

    select * from fa_card where pk_corp='1003' and (card_code between '000000503' and '000000811')
    order by card_code for update

    查询结果为空。

    因为想在上plsql从excel复制更改名称,我因为做了固定资产的使用部门更改,我惊喜的发现ts会变成现在的时间,于是

    select * from fa_card where pk_corp='1003' and ts like '2012-06-04 %'
    order by card_code for update

    可行

    之后开始涉及更改原值和累计折旧了,这时候问题来了,NC里面对每个卡片是区分每个月的,也就是每次计提一笔,在fa_cardhistory就一个记录,因此,每个卡片从08年大概80多个需要改动原值的,一共需要改动2万多个。OMG

    开始动脑筋。

    我在fa_card中不用的一列provider从excel中把原值拷贝到里面,如下图:

    然后利用我之前学到的sql,update中涉及两个表之间的关系来更改两万多行中的fa_cardhistory的本币原值。

    update (select fa_cardhistory.localoriginvalue a,fa_card.provider b
    from fa_cardhistory,fa_card
    where fa_cardhistory.fk_card=fa_card.pk_card
    and fa_card.pk_corp='1003' and fa_card.ts like '2012-06-04 %')
    set a=b

    原值终于搞定了:

    现在要改累计折旧了,下面的sql应该有问题,因为累计折旧不可能是不变的,不过应付检查可以了

    update fa_cardhistory set accudep=0.7*fa_cardhistory.localoriginvalue where
     fk_card in (select pk_card from fa_card where pk_corp='1003' and ts like '2012-06-04 %' )

  • 相关阅读:
    C#定时执行任务
    C#判断数据库是否可连接(PING)
    Excel之导入数据
    JQuery之杂项方法$.grep()
    .Net EF 之代码生成策略
    平台与WeLink深度融合技术汇总
    Host is not allowed to connect to this MySQL
    excel中过长的数字怎么筛选重复项
    oracle 函数大全
    WinXP添加TLS1.1、TLS1.2支持
  • 原文地址:https://www.cnblogs.com/sumsen/p/2534646.html
Copyright © 2011-2022 走看看