国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發(fā) > 綜合 > 正文

新舊系統(tǒng)切換中 資料內(nèi)碼 處理

2024-07-21 02:05:35
字體:
供稿:網(wǎng)友

原系統(tǒng) :mssql server 7.0+delphi

新系統(tǒng) :mssql server 2000 + delphi

需要處理資料:spkfk(商品庫(kù)房庫(kù)) :

                         (spid , //商品內(nèi)碼 pk

                          spbh ,//商品編號(hào) unique index 

                          spmch ,//商品名稱

                          shpgg ,//商品規(guī)格

                          dw , //單位

                         shpchd //商品產(chǎn)地  )



新系統(tǒng)中資料來源為原系統(tǒng)中 spkfk ,  原系統(tǒng)中無 spid 字段 , 需在導(dǎo)入時(shí)生成。

將舊系統(tǒng)業(yè)務(wù)數(shù)據(jù)庫(kù)(dtx4) 附加到mssql2000中

執(zhí)行如下操作:

use st70 --新系統(tǒng)業(yè)務(wù)數(shù)據(jù)庫(kù)

declare @tran_point int 

set @[email protected]@trancount  --獲取系統(tǒng)事務(wù)數(shù)

if @tran_point=0   begin tran tran_c  --開始事務(wù)else  save tran tran_c  --設(shè)置事務(wù)保存點(diǎn)



declare @spid char(11) --定義變量set @spid='' 

declare @id  int  --定義 內(nèi)碼 數(shù)值變量

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

select @spid as spid , spbh ,spmch ,shpgg , dw ,shpchd  into  #t1    --提取原系統(tǒng)中 商品信息from dtx40..spkfk

   if @@error<>0 goto err_lab

update #t1 set [email protected] ,@[email protected]+1  -- 生成商品內(nèi)碼數(shù)值

   if @@error<>0 goto err_lab

update #t1 set spid='sph' + replicate('0',8-len(ltrim(rtrim(spid))))+ltrim(rtrim(spid)) --生成商品內(nèi)碼(商品內(nèi)碼為: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)  --將數(shù)據(jù)插入到目的表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  --取消事務(wù)

returnlb:       commit tran tran_c   --提交事務(wù)



以上為商品資料的內(nèi)碼處理,其他資料同上。      

















  










注冊(cè)會(huì)員,創(chuàng)建你的web開發(fā)資料庫(kù),
發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 鄯善县| 金华市| 钟祥市| 江津市| 肇源县| 内黄县| 清远市| 成都市| 福州市| 小金县| 泰和县| 读书| 许昌县| 兴安县| 大同市| 宿州市| 广平县| 临漳县| 山丹县| 伊吾县| 曲周县| 库车县| 西安市| 习水县| 腾冲县| 大连市| 西乡县| 邢台县| 揭阳市| 阳原县| 曲麻莱县| 祁东县| 百色市| 新丰县| 德阳市| 台中县| 肥乡县| 响水县| 渝北区| 安新县| 太白县|