数据库关联表字段存量数据转移
来源:互联网 发布:eval解析json字符串 编辑:程序博客网 时间:2024/04/28 01:08
#!/bin/sh
rm cwsupdate.sql cwsstatis.del
if [ $# -ne 2 ]; then
echo "use as ./trans_sh db2name db2passwd"
exit 1
fi
db2 connect to mbonldb user $1 using $2
db2 set current schema schema名
db2 "export to cwsstatis.del of del select distinct 字段, 字段,字段 from 表名"
if [ -f cwsstatis.del ];then
sed -i "s/\"/'/g" cwsstatis.del
else
echo "error!!!db2 export not ok"
exit 1
fi
awk -F ',' '{print "update 表名 set 字段=" $1 ",字段 =" $2 " where 字段 =\047\047 and字段 =" $3";" >> "cwsupdate.sql"}' cwsstatis.del
if [ -f cwsupdate.sql ];then
db2 -tvf cwsupdate.sql
rm cwsupdate.sql cwsstatis.del
if [ $# -ne 2 ]; then
echo "use as ./trans_sh db2name db2passwd"
exit 1
fi
db2 connect to mbonldb user $1 using $2
db2 set current schema schema名
db2 "export to cwsstatis.del of del select distinct 字段, 字段,字段 from 表名"
if [ -f cwsstatis.del ];then
sed -i "s/\"/'/g" cwsstatis.del
else
echo "error!!!db2 export not ok"
exit 1
fi
awk -F ',' '{print "update 表名 set 字段=" $1 ",字段 =" $2 " where 字段 =\047\047 and字段 =" $3";" >> "cwsupdate.sql"}' cwsstatis.del
if [ -f cwsupdate.sql ];then
db2 -tvf cwsupdate.sql
else
echo "error!!!awk not ok"
exit 1
fi
注:单引号用\047代替
0 0
- 数据库关联表字段存量数据转移
- 数据库表字段数据分割问题
- yii 关联表字段排序
- Yii关联表字段查询
- 数据库表字段介绍
- 修改数据库表字段
- 修改数据库表字段
- 数据库表字段规范
- 关于数据库表字段的数据权限设计
- 使用JdbcTemplate来获取数据库表字段对应的数据
- 修改数据库表字段长度
- oracle数据库查询表字段
- 动态增加数据库表字段
- 如何扩展数据库表字段
- ResultSetMetaData获取数据库表字段
- 增加 大量数据 表字段
- 根据基础数据表id获取数据库中关联表字段内容方法
- 拆分数据库表字段,用拆分后的字段重新建表并删除关联表
- Object C学习笔记13-Dictionary
- UITextField 常用操作
- 人生不过一场梦
- IOS 7 Xcode 5 免IDP证书 真机调试
- 关于 MySQL LEFT JOIN 你可能需要了解的三点
- 数据库关联表字段存量数据转移
- double与string的相互转化(C++)
- MyEclipse注册码获取
- 链表(线性表)
- mysql 指定日期格式查询
- UILabel常用操作
- 听海哭的声音
- C语言基础七typedef
- C#反射的作用