This article describes how to execute SQL scripts in the DB2 command window for your reference.
You can run SQL scripts in the Command Editor, DB2 command window in Windows, or shell in Linux. Run the following SQL statement in the windows DB2 command window or linux shell:
Db2-t-v-f script1. SQL-z script1.log
Or:
Db2-tvf script1. SQL-z script1.log
In the preceding command,
-T indicates that the statement uses the default statement Terminator-semicolon;
-V indicates that the lengthy mode is used, so that DB2 displays information about each command being executed;
-F indicates that it is a script file;
-Z indicates that the information record file is used to record the output of the screen. This is optional for future analysis, but we recommend that you use this option ).
If the-t option is used but the statement Terminator is not specified, the semicolon;) is the statement Terminator by default. Sometimes there may be situations where another Terminator is used. For example, scripts written in SQL PL use other symbols instead of default semicolons, because a semicolon ends a statement used to define a database object in SQL PL.