简体   繁体   中英

How to export table datas to txt(or)csv files? Only Last query resultsets got exported into file?

I am new Bash shell script and exporting the table datas into txt file.

db2 "export to $filename of del messages msg.txt select * from students_table" 

file Contains "FirstName","23","Pass"

Again i am using the same file name

$filename

 db2 "export to $filename of del messages msg.txt select * from employees_table"

Now the output is "EmployeeName","25,000","Salaried" Only last query result set got printed.

Expected Output is

  1. "FirstName","23","Pass"
  2. "EmployeeName","25,000","Salaried"

help me to resolve this. thanks in advance.

EXPORT command overwrites the file if it exists:

TO filename

...

If the name of a file that exists is specified, the export utility overwrites the contents of the file; it does not append the information.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM