• 软件测试技术
  • 软件测试博客
  • 软件测试视频
  • 开源软件测试技术
  • 软件测试论坛
  • 软件测试沙龙
  • 软件测试资料下载
  • 软件测试杂志
  • 软件测试人才招聘
    暂时没有公告

字号: | 推荐给好友 上一篇 | 下一篇

新旧系统切换中 资料内码 处理

发布: 2007-7-02 11:08 | 作者: admin | 来源: | 查看: 8次 | 进入软件测试论坛讨论

领测软件测试网
原系统 :MSSQL SERVER 7.0+DELPHI

新系统 :MSSQL SERVER 2000 + DELPHI

需要处理资料:spkfk(商品库房库) :

                         (spid , //商品内码 pk

                          spbh ,//商品编号 Unique index 

                          spmch ,//商品名称

                          shpgg ,//商品规格

                          dw , //单位

                         shpchd //商品产地  )



新系统中资料来源为原系统中 SPKFK ,  原系统中无 SPID 字段 , 需在导入时生成。

将旧系统业务数据库(dtx4) 附加到MSSQL2000中

执行如下操作:

use st70 --新系统业务数据库

declare @tran_point int 

set @tran_point=@@trancount  --获取系统事务数

if @tran_point=0   begin tran tran_c  --开始事务else  save tran tran_c  --设置事务保存点



declare @spid char(11) --定义变量set @spid=@#@# 

declare @id  int  --定义 内码 数值变量

set @id = 0  --初始化 起始 值

select @spid as spid , spbh ,spmch ,shpgg , dw ,shpchd  into  #t1    --提取原系统中 商品信息from dtx40..spkfk

   if @@error<>0 goto err_lab

update #t1 set spid=@id ,@id=@id+1  -- 生成商品内码数值

   if @@error<>0 goto err_lab

update #t1 set spid=@#SPH@# + REPLICATE(@#0@#,8-len(ltrim(rtrim(spid))))+ltrim(rtrim(spid)) --生成商品内码(商品内码为:SPHxxxxxxxxx)          if @@error<>0 goto err_lab

delete from spkfk  --清空 目的表         if @@error<>0 goto err_lab

insert into spkfk(spid , spbh , spmch ,shpgg ,dw ,shpchd)  --将数据插入到目的表select spid , spbh , spmch ,shpgg ,dw ,shpchd from #t1

      if @@error<>0 goto err_lab

drop table #t1

if @tran_point=0  goto returnlb 

err_lab:       rollback tran tran_c  --取消事务

returnlb:       commit tran tran_c   --提交事务



以上为商品资料的内码处理,其他资料同上。      

















  










文章来源于领测软件测试网 https://www.ltesting.net/


关于领测软件测试网 | 领测软件测试网合作伙伴 | 广告服务 | 投稿指南 | 联系我们 | 网站地图 | 友情链接
版权所有(C) 2003-2010 TestAge(领测软件测试网)|领测国际科技(北京)有限公司|软件测试工程师培训网 All Rights Reserved
北京市海淀区中关村南大街9号北京理工科技大厦1402室 京ICP备2023014753号-2
技术支持和业务联系:info@testage.com.cn 电话:010-51297073

软件测试 | 领测国际ISTQBISTQB官网TMMiTMMi认证国际软件测试工程师认证领测软件测试网