 转换(导入)客户辅助余额
insert into ufdata_101_2003.dbo.gl_accass
(ccode,cexch_name,iperiod,ccus_id,cbegind_c,cbegind_c_engl,mb,cendd_c,
cendd_c_engl,me)
select fnumber,Null,fperiod,ccus_id,case when fdc=1 then '借'else '贷' end,
case when fdc=1 then 'Dr'else 'Cr' end,fbeginbalance,
case when fdc=1 then '借'else '贷' end,
case when fdc=1 then 'Dr'else 'Cr' end,fbeginbalance
from t_banlance_cus
where fyear=2003 AND (FPeriod = 1)
insert into ufdata_101_2003.dbo.gl_accass
(ccode,cexch_name,iperiod,ccus_id,cbegind_c,cbegind_c_engl,mb,cendd_c,
cendd_c_engl,me)
select fnumber,Null,2,ccus_id,case when fdc=1 then '借'else '贷' end,
case when fdc=1 then 'Dr'else 'Cr' end,fbeginbalance,
case when fdc=1 then '借'else '贷' end,
case when fdc=1 then 'Dr'else 'Cr' end,fbeginbalance
from t_banlance_cus
where fyear=2003 AND (FPeriod = 1)
insert into ufdata_101_2003.dbo.gl_accass
(ccode,cexch_name,iperiod,ccus_id,cbegind_c,cbegind_c_engl,mb,cendd_c,
cendd_c_engl,me)
select fnumber,Null,3,ccus_id,case when fdc=1 then '借'else '贷' end,
case when fdc=1 then 'Dr'else 'Cr' end,fbeginbalance,
case when fdc=1 then '借'else '贷' end,
case when fdc=1 then 'Dr'else 'Cr' end,fbeginbalance
from t_banlance_cus
where fyear=2003 AND (FPeriod = 1)
insert into ufdata_101_2003.dbo.gl_accass
(ccode,cexch_name,iperiod,ccus_id,cbegind_c,cbegind_c_engl,mb,cendd_c,
cendd_c_engl,me)
select fnumber,Null,4,ccus_id,case when fdc=1 then '借'else '贷' end,
case when fdc=1 then 'Dr'else 'Cr' end,fbeginbalance,
case when fdc=1 then '借'else '贷' end,
case when fdc=1 then 'Dr'else 'Cr' end,fbeginbalance
from t_banlance_cus
where fyear=2003 AND (FPeriod = 1)
insert into ufdata_101_2003.dbo.gl_accass
(ccode,cexch_name,iperiod,ccus_id,cbegind_c,cbegind_c_engl,mb,cendd_c,
cendd_c_engl,me)
select fnumber,Null,5,ccus_id,case when fdc=1 then '借'else '贷' end,
case when fdc=1 then 'Dr'else 'Cr' end,fbeginbalance,
case when fdc=1 then '借'else '贷' end,
case when fdc=1 then 'Dr'else 'Cr' end,fbeginbalance
from t_banlance_cus
where fyear=2003 AND (FPeriod = 1)
insert into ufdata_101_2003.dbo.gl_accass
(ccode,cexch_name,iperiod,ccus_id,cbegind_c,cbegind_c_engl,mb,cendd_c,
cendd_c_engl,me)
select fnumber,Null,6,ccus_id,case when fdc=1 then '借'else '贷' end,
case when fdc=1 then 'Dr'else 'Cr' end,fbeginbalance,
case when fdc=1 then '借'else '贷' end,
case when fdc=1 then 'Dr'else 'Cr' end,fbeginbalance
from t_banlance_cus
where fyear=2003 AND (FPeriod = 1)
insert into ufdata_101_2003.dbo.gl_accass
(ccode,cexch_name,iperiod,ccus_id,cbegind_c,cbegind_c_engl,mb,cendd_c,
cendd_c_engl,me)
select fnumber,Null,7,ccus_id,case when fdc=1 then '借'else '贷' end,
case when fdc=1 then 'Dr'else 'Cr' end,fbeginbalance,
case when fdc=1 then '借'else '贷' end,
case when fdc=1 then 'Dr'else 'Cr' end,fbeginbalance
from t_banlance_cus
where fyear=2003 AND (FPeriod = 1)
insert into ufdata_101_2003.dbo.gl_accass
(ccode,cexch_name,iperiod,ccus_id,cbegind_c,cbegind_c_engl,mb,cendd_c,
cendd_c_engl,me)
select fnumber,Null,8,ccus_id,case when fdc=1 then '借'else '贷' end,
case when fdc=1 then 'Dr'else 'Cr' end,fbeginbalance,
case when fdc=1 then '借'else '贷' end,
case when fdc=1 then 'Dr'else 'Cr' end,fbeginbalance
from t_banlance_cus
where fyear=2003 AND (FPeriod = 1)
insert into ufdata_101_2003.dbo.gl_accass
(ccode,cexch_name,iperiod,ccus_id,cbegind_c,cbegind_c_engl,mb,cendd_c,
cendd_c_engl,me)
select fnumber,Null,9,ccus_id,case when fdc=1 then '借'else '贷' end,
case when fdc=1 then 'Dr'else 'Cr' end,fbeginbalance,
case when fdc=1 then '借'else '贷' end,
case when fdc=1 then 'Dr'else 'Cr' end,fbeginbalance
from t_banlance_cus
where fyear=2003 AND (FPeriod = 1)
insert into ufdata_101_2003.dbo.gl_accass
(ccode,cexch_name,iperiod,ccus_id,cbegind_c,cbegind_c_engl,mb,cendd_c,
cendd_c_engl,me)
select fnumber,Null,10,ccus_id,case when fdc=1 then '借'else '贷' end,
case when fdc=1 then 'Dr'else 'Cr' end,fbeginbalance,
case when fdc=1 then '借'else '贷' end,
case when fdc=1 then 'Dr'else 'Cr' end,fbeginbalance
from t_banlance_cus
where fyear=2003 AND (FPeriod = 1)
insert into ufdata_101_2003.dbo.gl_accass
(ccode,cexch_name,iperiod,ccus_id,cbegind_c,cbegind_c_engl,mb,cendd_c,
cendd_c_engl,me)
select fnumber,Null,11,ccus_id,case when fdc=1 then '借'else '贷' end,
case when fdc=1 then 'Dr'else 'Cr' end,fbeginbalance,
case when fdc=1 then '借'else '贷' end,
case when fdc=1 then 'Dr'else 'Cr' end,fbeginbalance
from t_banlance_cus
where fyear=2003 AND (FPeriod = 1)
insert into ufdata_101_2003.dbo.gl_accass
(ccode,cexch_name,iperiod,ccus_id,cbegind_c,cbegind_c_engl,mb,cendd_c,
cendd_c_engl,me)
select fnumber,Null,12,ccus_id,case when fdc=1 then '借'else '贷' end,
case when fdc=1 then 'Dr'else 'Cr' end,fbeginbalance,
case when fdc=1 then '借'else '贷' end,
case when fdc=1 then 'Dr'else 'Cr' end,fbeginbalance
from t_banlance_cus
where fyear=2003 AND (FPeriod = 1)
 转换(导入)供应商辅助余额(类似客户辅助余额)
insert into ufdata_101_2003.dbo.gl_accass
(ccode,cexch_name,iperiod,csup_id,cbegind_c,cbegind_c_engl,mb,cendd_c,
cendd_c_engl,me)
select fnumber,Null,fperiod,csup_id,case when fdc=1 then '借'else '贷' end,
case when fdc=1 then 'Dr'else 'Cr' end,fbeginbalance,
case when fdc=1 then '借'else '贷' end,
case when fdc=1 then 'Dr'else 'Cr' end,fbeginbalance
from t_banlance_sup
where fyear=2003 AND (FPeriod = 1)
 转换(导入)客户辅助明细
insert into ufdata_101_2003.dbo.gl_accvouch
(iperiod,dbill_date,cbook,cdigest,ccode,cexch_name,md,ccus_id,idoc,inid,ibook)
select 0,'2002-12-30','demo','期初数据',fnumber,NULL,FBeginBalance,ccus_id,
1,1,1
from t_banlance_cus
where fyear=2003 and fperiod=1
 转换(导入)供应商辅助明细
insert into ufdata_101_2003.dbo.gl_accvouch
(iperiod,dbill_date,cbook,cdigest,ccode,cexch_name,mc,csup_id,idoc,inid,ibook)
select 0,'2002-12-30','demo','期初数据',fnumber,NULL,FBeginBalance,csup_id,
1,1,1
from t_banlance_sup
where fyear=2003 and fperiod=1
三、 转换XXXX年的凭证数据:
insert into ufdata_101_2003.dbo.gl_accvouch
(dbill_date,iperiod,csign,isignseq,ino_id,inid,ccode,md,mc,idoc,cbill,ccheck,
cdigest,ccus_id,csup_id,ccode_equal)
select fdate,fperiod,'记','1',fnumber,fentryid+1,code,
case when fdc=1 then famount else 0 end,
case when fdc=0 then famount else 0 end,
fattachments,cmaker,chechkname,fexplanation,null,null,dfcode
from t_voucheraihp
where fdetailid=0 and fyear=2003
insert into ufdata_101_2003.dbo.gl_accvouch
(dbill_date,iperiod,csign,isignseq,ino_id,inid,ccode,md,mc,idoc,cbill,ccheck,
cdigest,ccus_id,csup_id,ccode_equal)
select fdate,fperiod,'记','1',fnumber,fentryid+1,code,
case when fdc=1 then famount else 0 end,
case when fdc=0 then famount else 0 end,
fattachments,cmaker,chechkname,fexplanation,ccus_id,null,dfcode
from t_voucheraihpcus
where fyear=2003
insert into ufdata_101_2003.dbo.gl_accvouch
(dbill_date,iperiod,csign,isignseq,ino_id,inid,ccode,md,mc,idoc,cbill,ccheck,
cdigest,ccus_id,csup_id,ccode_equal)
select fdate,fperiod,'记','1',fnumber,fentryid+1,code,
case when fdc=1 then famount else 0 end,
case when fdc=0 then famount else 0 end,
fattachments,cmaker,chechkname,fexplanation,null,ccup_id,dfcode
from t_voucheraihpsup
where fyear=2003
特殊说明:用友软件按年度划分年度账套,但金蝶软件没有年度账套的概念,即依此类推如果需要继续将金蝶2004年的凭证数据转换为用友的凭证数据,则转换语句应为:
insert into ufdata_101_2004.dbo.gl_accvouch
(dbill_date,iperiod,csign,isignseq,ino_id,inid,ccode,md,mc,idoc,cbill,ccheck,
cdigest,ccus_id,csup_id,ccode_equal)
select fdate,fperiod,'记','1',fnumber,fentryid+1,code,
case when fdc=1 then famount else 0 end,
case when fdc=0 then famount else 0 end,
fattachments,cmaker,chechkname,fexplanation,null,null,dfcode
from t_voucheraihp
where fdetailid=0 and fyear=2004
……
四、 有关数据转换方法的其他辅助说明:
 查询金蝶XXXX年的年末科目余额:
SELECT * FROM t_balancels
WHERE (FYear = 2004) AND (FPeriod = 12)
ORDER BY FNumber
 查询金蝶软件的库表字段与库表结构:
字段:t_FieldDescription
表名:t_TableDescription |