清空科目主副表项目
前言:有些客户因为业务变动需要对主副表项目进行清空处理,现提供脚本支持
第一步:备份数据:
SELECT * into bak_kk_account1203 FROM T_BD_ACCOUNTVIEW
单个科目清空
确认科目id
清空选中科目的主副表项目
UPDATE T_BD_ACCOUNTVIEW SET FBORROWERMAINCASHFLOWITEMID='',FBORROWERATTCASHFLOWITEMID='',FLENDERMAINCASHFLOWITEMID='',FLENDERATTCASHFLOWITEMID='' WHERE fid='科目id'
同一组织多个科目清空
确认组织和科目表
清空选中科目的主副表项目
UPDATE T_BD_ACCOUNTVIEW SET FBORROWERMAINCASHFLOWITEMID='',FBORROWERATTCASHFLOWITEMID='',FLENDERMAINCASHFLOWITEMID='',FLENDERATTCASHFLOWITEMID='' WHERE FCOMPANYID =(select fid from t_org_company where FNUMBER ='组织编码') and
FACCOUNTTABLEID =(select fid from t_bd_accounttable where FNUMBER ='科目表编码') and FNUMBER in('科目编码1','科目编码2',...)
多组织同一科目清空
确认科目表和科目
清空选中科目的主副表项目
UPDATE T_BD_ACCOUNTVIEW SET FBORROWERMAINCASHFLOWITEMID='',FBORROWERATTCASHFLOWITEMID='',FLENDERMAINCASHFLOWITEMID='',FLENDERATTCASHFLOWITEMID='' WHERE FCOMPANYID in(select fid from t_org_company where FNUMBER in('组织编码1','组织编码2',...)) and
FACCOUNTTABLEID =(select fid from t_bd_accounttable where FNUMBER ='科目表编码') and FNUMBER ='科目编码'
请注意:请谨慎操作,如有误操作请使用数据回滚。如有疑问请提单处理,请不要出问题再提单。
推荐阅读