软件开发Db2

db2 export to 导出做追加?

db2 export to *.del of del ,多次执行export导出到同一个文件,如何能让export不是进行覆盖而是在后面做追加记录。

参与10

2同行回答

lych370lych370联盟成员系统运维工程师个人
可以通过使用命令行工具,使用>>符号将新导出的内容追加到源文件中,当然前提是查到在shell中使用导出命令的语句。具体命令db2 ? export查询下。没有具体操作过,理论上应该可以,仅供参考...显示全部

可以通过使用命令行工具,使用>>符号将新导出的内容追加到源文件中,当然前提是查到在shell中使用导出命令的语句。具体命令db2 ? export查询下。没有具体操作过,理论上应该可以,仅供参考

收起
银行 · 2023-04-03
cfpl_900cfpl_900联盟成员数据库管理员安信证券
db2 export to filename of del/ixf ....If the name of a file that already exists is specified, the export utility overwrites the contents of the file; it does not append the information. 所以使用export导出数据到同一个文件并不会追加,只会覆盖。但导...显示全部

db2 export to filename of del/ixf ....
If the name of a file that already exists is specified, the export utility overwrites the contents of the file; it does not append the information.
所以使用export导出数据到同一个文件并不会追加,只会覆盖。

但导出数据是为了导入的,导出时使用不同的文件名,并不会影响导入的。
使用db2 import from filename of del/ixf  insert into   可以将不同的文件追加导入。

收起
证券 · 2023-04-03

ChatGPT 回答

在Db2中,可以使用以下命令将数据导出到一个文件中:

db2 export to <filename> of del modified by coldel|delimiter <delimiter> select <columns> from <table>

其中,&lt;filename>是导出文件的名称,如果多次执行该命令并指定相同的文件名,会覆盖原有文件内容。如果需要将数据追加到同一个文件中,可以使用以下方法:

  1. 使用>>符号将输出追加到文件末尾:
db2 export to <filename> of del modified by coldel|delimiter <delimiter> select <columns> from <table> >> <filename>
  1. 使用APPEND选项将数据追加到文件末尾:
db2 export to <filename> of del modified by coldel|delimiter <delimiter> select <columns> from <table> append

以上两种方法都可以将数据追加到同一个文件中,而不是覆盖原有文件内容。

提问者

jiangnanage
java开发小白
擅长领域: 数据库存储灾备

相关问题

相关资料

相关文章

问题状态

  • 发布时间:2023-03-31
  • 关注会员:3 人
  • 问题浏览:1806
  • 最近回答:2023-04-03
  • X社区推广