當(dāng)前位置:財(cái)稅問題 >
實(shí)務(wù)
問題已解決
T+憑證摘要,可以一次過全刪除嗎?
溫馨提示:如果以上題目與您遇到的情況不符,可直接提問,隨時問隨時答
速問速答你好 可以
模塊: 總賬
【答復(fù)】:
--當(dāng)前此腳本修改的是所有組織的憑證摘要,故無組織條件的限制;第二份腳本文件為部分憑證的修改
--注:t_gl_voucher 該表中的憑證摘要不顯示,故修改的是t_gl_voucherenter表
--------------------------------修改憑證摘要--------------------------------
--憑證摘要
select a.* from T_GL_VoucherEntry a
inner join t_gl_voucher b on a.FBillID=b.fid
inner join T_ORG_Company c on b.FCompanyID=c.fid
inner join T_BD_Period d on b.FPeriodID=d.fid
where d.fnumber between 201401 and 201411--會計(jì)期間
and b.FDescription like %舊字符%
--備份
select a.* into T_GL_VoucherEntry_bak from T_GL_VoucherEntry a
inner join t_gl_voucher b on a.FBillID=b.fid
inner join T_ORG_Company c on b.FCompanyID=c.fid
inner join T_BD_Period d on b.FPeriodID=d.fid
where d.fnumber between 201401 and 201411--會計(jì)期間
and b.FAbstract like %舊字符%
--更改數(shù)據(jù)
update T_GL_VoucherEntry set FDescription=replace(FDescription,舊,新) where fbillid in (select a.fid from T_GL_Voucher a
where a.FPeriodID in (select fid from T_BD_Period where fnumber between 201401 and 201411))--會計(jì)期間所在年度
and FDescription like %舊%--舊的字符串
----------------------------------------------------------------------------
-------------------------------修改輔助賬摘要--------------------------------
--查詢輔助賬摘要
select a.* from T_GL_VoucherAssistRecord a where a.FDescription like %舊字符%--舊字符
and a.FBillID in (select fid from T_GL_Voucher a where a.FPeriodID in (select fid from T_BD_Period where fnumber between 201401 and 201411))--會計(jì)期間)
--備份將要修改的輔助賬摘要
select a.* into T_GL_VoucherAssistRecord_bak from T_GL_VoucherAssistRecord a where a.FDescription like %舊字符%--舊字符
and a.FBillID in (select fid from T_GL_Voucher a where a.FPeriodID in (select fid from T_BD_Period where fnumber between 201401 and 201411))--會計(jì)期間)
--修改輔助賬摘要
update T_GL_VoucherAssistRecord ?set FDescription=replace(FDescription,舊字符,新字符) where FDescription like %舊字符%--舊字符
and FBillID in (select fid from T_GL_Voucher a where a.FPeriodID in (select fid from T_BD_Period where fnumber between 201401 and 201411))--會計(jì)期間)
----------------------------------------------------------------------------
--此腳本適用于修改部分憑證摘要的問題
--------------------------------修改憑證摘要--------------------------------
--憑證摘要
select a.* from T_GL_VoucherEntry a
inner join t_gl_voucher b on a.FBillID=b.fid
inner join T_ORG_Company c on b.FCompanyID=c.fid
inner join T_BD_Period d on b.FPeriodID=d.fid
where d.fnumber between 201401 and 201412--會計(jì)期間
and b.FDescription like %新字符% and ?c.FName_L2 = --公司名稱
and b.fnumber=--憑證編碼
--備份
select a.* into T_GL_VoucherEntry_bak from T_GL_VoucherEntry a
inner join t_gl_voucher b on a.FBillID=b.fid
inner join T_ORG_Company c on b.FCompanyID=c.fid
inner join T_BD_Period d on b.FPeriodID=d.fid
where d.fnumber between 201401 and 201411--會計(jì)期間
and b.FDescription ?like %舊字符% and c.FName_L2=--公司名稱
and b.fnumber=--憑證編碼
--更改數(shù)據(jù)
update T_GL_VoucherEntry set FDescription=replace(FDescription,舊,新) where fbillid in (select a.fid from T_GL_Voucher a
where fnumber=--憑證編碼
and FCompanyID=(select fid from T_ORG_Company where fname_l2=)--公司名稱
and FPeriodID in (select fid from T_BD_Period where fnumber between 201401 and 201412))--會計(jì)期間
and FDescription like %舊%--舊的字符串
----------------------------------------------------------------------------
-------------------------------修改輔助賬摘要--------------------------------
--查詢輔助賬摘要
select a.* from T_GL_VoucherAssistRecord a where a.FDescription like %舊字符%--舊字符
and a.FBillID in (select fid from T_GL_Voucher a where a.FCompanyID=(select fid from T_ORG_Company where fname_l2=)--組織名稱
and a.fnumber=--憑證編碼
and a.FPeriodID in (select fid from T_BD_Period where fnumber between 201401 and 201412))--會計(jì)期間
--備份將要修改的輔助賬摘要
select a.* into t_gl_voucherassistrecord_bak from T_GL_VoucherAssistRecord a where a.FDescription like %舊字符%--舊字符
and a.FBillID in (select fid from T_GL_Voucher a where a.FCompanyID=(select fid from T_ORG_Company where fname_l2=)--組織名稱
and a.fnumber=--憑證編碼
and a.FPeriodID in (select fid from T_BD_Period where fnumber between 201401 and 201412))--會計(jì)期間
--修改輔助賬摘要
update T_GL_VoucherAssistRecord set fdescription=replace(fdescription,舊字符,新字符) where FDescription like %舊字符%--舊字符
and FBillID in (select fid from T_GL_Voucher a where a.FCompanyID=(select fid from T_ORG_Company where fname_l2=)--組織名稱
and fnumber=--憑證編碼
and FPeriodID in (select fid from T_BD_Period where fnumber between 201401 and 201412))--會計(jì)期間
--
2023 10/12 13:35
閱讀 286