转换数据-培训版

上传人:桔**** 文档编号:489636583 上传时间:2024-02-11 格式:DOCX 页数:9 大小:172.98KB
返回 下载 相关 举报
转换数据-培训版_第1页
第1页 / 共9页
转换数据-培训版_第2页
第2页 / 共9页
转换数据-培训版_第3页
第3页 / 共9页
转换数据-培训版_第4页
第4页 / 共9页
转换数据-培训版_第5页
第5页 / 共9页
点击查看更多>>
资源描述

《转换数据-培训版》由会员分享,可在线阅读,更多相关《转换数据-培训版(9页珍藏版)》请在金锄头文库上搜索。

1、编号:时间:2021年x月x日书山有路勤为径,学海无涯苦作舟页码:第1页 共1页数据转换培训1. 需掌握的基本技能1.1. SQLSERVER DTS工具DTS工具是SQLSERVER本身自带的工具,用以将外部指定格式的数据导入到SQLSERVER相应的表中。目前主要掌握EXCEL方式的倒入,具体步骤如下:以下示例就是将DTS.XLS文件中的数据导入到HBPOSV7中的t_bd_item_info表中。然后一直点下一步直到完成注意事项:如果导入过程中报错,请根据实际情况来相应处理。本文后面会介绍一些常见的报错处理方法。1.2. SQLSERVER 基本语法关键语法:掌握select语句,upd

2、ate语句,insert 语句。常用函数:convert, substring,left,right,isnumeric等。常用判断语句:判断空:columns = or columns is null 判断重复: group by columns having count(columns)1 判断长度:datalength(columns)1-删除重复delete tempitem where item_no in(select item_no from tempitem group by item_no having count(*)1)item_clsno:1.长度为6字符2.不允许为空

3、3.是否所有的类别编号在类别表都有-检查类别编码为空select * from tempitem where item_clsno= or item_no is null-处理类别编码为空修改为其它类别LBupdate tempitem set item_clsno=LB where where item_clsno= or item_no is null-检查类别编号是否存在select distinct(item_clsno) from tempitem where item_clsno not in(select item_clsno from t_bd_item_cls where i

4、tem_flag=0)main_supcust1.长度8字符2.不允许为空3.是否所有的供应商编号在供应商表中都存在-检查供应商编号是否为空select * from tempitem where main_supcust= or main_supcust is null-处理供应商编号为空的商品,修改成自行添加的一个供应商tempsup-tempsup是我们自行增加的用来处理临时的无供应商商品update tempitem set main_supcust=tempsup where main_supcust= or main_supcst is null-检查供应商编号是否存在select

5、 distinct(main_supcust) from tempitem where main_supcust not in(select supcust_no from t_bd_supcust_info where supcust_flag=S )-另注意不要把供应商设置成0供应商,有时候客户倒入倒出的时候会删除掉这个供应商select * from tempitem where main_supcust=0-如果检查出某些商品资料的供应商在供应商表中不存在,请添加供应商档案item_name 1.40个字符(20个汉字)-这里取左起20位,由于汉字在SQLSERVER的LEFT函数中算

6、1个长度所以只取前20位-品名一般都是汉字,有点偏差就无所谓了,客户自己去改update tempitem set item_name=left(item_name,20) where datalength(item_name)40item_subname1.20个字符(10个汉字)update tempitem set item_name=left(item_subname,10) where datalength(item_subname)20price1.必须是数字型select * from tempitem where isnumeric(price)=1sale_pricesele

7、ct * from tempitem where isnumeric(sale_price)=1(C)上面的检查通过后再将tempitem中处理后的数据插入到t_bd_item_info中通过触发器生成相应数据, 注意t_bd_supcust_item要手动去生成,如客户有需要则帮他们生成下Insert into t_bd_item_info(item_no,item_subno,item_name,item_subname,item_clsno,main_supcust,price,sale_price) select * from tempitem2.3.2. 捆绑商品表商品档案相应字段:

8、combine_sta = 12.3.3. 一品多码表-注意一品多码表中的附加码item_barcode是否在商品档案中存在-如果存在根据实际情况来判断是否删除。select * from t_bd_item_barcode where item_barcode in(select item_no from t_bd_item_info)2.3.4. t_rm_vip_info方法类似t_bd_item_info.card_id1.20位2.不为空3.不重复card_flowno1.20位2.不为空3.不重复另注意:1.use_num使用次数2。有效期限, vip_start_date,vip_end_date3.积分acc_num-dec_num4.储值金额 residual_amt 如何加密原值插入表后然后通过系统导入导出功能导出,然后再导入选择金额未加密5T_rm_vip_consume积分明细数据不需要处理,通过导入导出自动生成6t_rm_saving_plus_record充值记录表也不需要处理,通过导入导出自动生成2.4. 整体数据测试。(D)全部转换完毕后记得将制作好的数据在系统中导出,然后再导入看是否能正常导入。第 1 页 共 1 页

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 办公文档 > PPT模板库 > 总结/计划/报告

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号