Skip to content

Instantly share code, notes, and snippets.

@eagleon
Last active August 29, 2015 14:10
Show Gist options
  • Save eagleon/85a7ee07b54e095550c1 to your computer and use it in GitHub Desktop.
Save eagleon/85a7ee07b54e095550c1 to your computer and use it in GitHub Desktop.
db2 常见操作

db2 常见操作

  1. 删除当前schema下所有表:

DB2不提供命令删除某个schema下的数据,但可以通过脚本来做。

  db2 "select 'drop table ' || rtrim(tabschema) ||'.' ||tabname || ';' from syscat.tables where tabschema='testschema' " > droptable.ddl
  
  db2 connect to <db>
  db2 -tvf droptable.ddl
  1. DB2常见错误:

-803 主键冲突,违反唯一约束
-204 表或对象不存在

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment