Printing the output of a db2 query on to an unix file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Printing the output of a db2 query on to an unix file
# 1  
Old 02-29-2012
Question Printing the output of a db2 query on to an unix file

I want to print the output of a db2 query, on to an unix file in a manner that the columns are separated by 'commas'. Please help me out..thanx in advance
# 2  
Old 02-29-2012
Hi,

did you have a look at:
http://www.dbforums.com/db2/1615830-...-os-390-a.html
CSV file with Headers
Export to CSV-File - DB2 Database

see ya
fra

Last edited by frappa; 02-29-2012 at 03:29 AM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Db2 query on other host

Hello, i need some help with a script. I made a script, which connect to different hosts to get some informations. But i got now some problems with getting informations of a database (db2) which is on a other host. I tried something like var=$(rsh HOST su - db2adm -c "db2 connect to database;... (2 Replies)
Discussion started by: Cyver
2 Replies

2. Shell Programming and Scripting

SQL query in UNIX script - output in flat file

Hi, I never did this before... what I want to do is execute a SQL query from a unix script and redirect sql query's output to a flat file (comma separated one) without the header info (no column names). I would also want not to print the query's output to the screen. snapshot of my script:... (13 Replies)
Discussion started by: juzz4fun
13 Replies

3. AIX

DB2 user query utilization?

I am new to AIX, but not new to the UNIX world. Recently I got a request to come with some kind of report to do the following: report if user query is using > 70% CPU (within DB2) > 5 minutes. I am by no means a DB2 guru so I do not know how to get that from within it, so I was wondering if there... (4 Replies)
Discussion started by: savigabi
4 Replies

4. UNIX for Dummies Questions & Answers

UNIX Query About wc -l output

I was performing the wc -l operation in one data file the result is less when i was giving -nu on the view of the file. while giving wc -l the count is 5023 after setting line numbers in view of file is giving 5024. Can anyone help on this.... (5 Replies)
Discussion started by: abhii
5 Replies

5. Shell Programming and Scripting

Need Fix in Exporting a db2 query output

When I use export for sql query in a Script : Select '1',ModHist',count(*) from cc.mdhist; it was exporting the record to a file as: "1" "ModHist" 778201 Here 1 & ModHist are coming in Doublequotes. If I run the above query directly in Unix prompt it was displaying the output as... (1 Reply)
Discussion started by: karumudi7
1 Replies

6. Shell Programming and Scripting

Db2 query with script

Hi All, I want to connect two tables in DB2 using shell script and then compare the contents of two tables field by field.and i should return on the screen the un matched records .. Could any one please help me in connecting database tables using Unix and retriving data from the same. (1 Reply)
Discussion started by: kanakaraju
1 Replies

7. Shell Programming and Scripting

issue with the query output in unix

I am running a query with contains blank spaces in between in the output. But when I open and read the file in UNIX i am not able to cursor the balnk spaces instead it is moving like tabs. Please help suppose my query - Select ' '||text from tab1; the cursor should move to 1st and... (1 Reply)
Discussion started by: sbmk_design
1 Replies

8. Shell Programming and Scripting

need help in reading a output of a sql query in unix script

i'm used a sql query in a unix script to get the information from table. but unable to extract the output which i need. Any help with logic will be greatly appreciated. my sql query provide output some thing like this - col1 col2 count ---- ---- ------ A B 10 c D 6 e... (8 Replies)
Discussion started by: pharos467
8 Replies

9. Shell Programming and Scripting

Run SQL queries in DB2 and output to file

Hi, I new to Unix and scripting. Following is my requirement. Can someone tell me whether its possible or not. Also please let me know how to proceed further if this is possible. List of queries are stored in a file. For example, I have to run a query like this: Select * from &XYZ where... (0 Replies)
Discussion started by: simhasuri
0 Replies

10. Shell Programming and Scripting

flags to suppress column output, # of rows selected in db2 sql in UNIX

Hello, I am new to db2 SQL in unix so bear with me while I try to explain the situation. I have a text file that has the contents of the where condition that I am using for a db2 SQL in UNIX ksh. Here is the snippet. if ; then echo "Begin processing VALUEs" ... (1 Reply)
Discussion started by: jerardfjay
1 Replies
Login or Register to Ask a Question