DB2中执行sql语句文件

在新建数据库中执行还原表结构语句

db2 -tvf db.sql

https://datageek.blog/2014/09/02/db2-basics-executing-a-script-of-sql/#:~:text=Here%20is%20the%20breakdown%20of%20these%20options%20I,number%20of%20lines%20affected%20by%20DML%20More%20items

Basic Command Line Options

There are several command line options, I used above. Here is the breakdown of these options I use most frequently:

t – terminated – the statements are terminated with a delimiter. The default delimiter is the semi-colon
d – delimiter – the default delimiter is being overriden, and db2 uses the character immediately following d as the delimiter.
v – verbose – the statement will be echoed in output prior to the result of the statement. This is extremely useful when reviewing output or troubleshooting failed statements
m – prints the number of lines affected by DML
f – file – indicates that db2 should execute statements from a file, with the filename specified one space after the f.

posted @ 2023-05-22 14:28  ~博客~  阅读(48)  评论(0)    收藏  举报