If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > CLP - cannot change DB2OPTIONS

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-03-10, 03:43
Howardw Howardw is offline
Registered User
 
Join Date: Nov 2009
Posts: 18
CLP - cannot change DB2OPTIONS

I am runnig db2 9.7 on Vista

I want to send the output of a query from the CLP to a file in a specific directory

However if I put a backslash in the file redirect i get an error
example: select * from table1>C:mydir\output.txt

Also I do not seem to be able to set the DB2OPTIONS on

example: -r (save output to a report file) is set to off - i cannot set it on
what command do i need to use to change the default
Reply With Quote
  #2 (permalink)  
Old 02-03-10, 08:13
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
Look for "UPDATE COMMAND OPTIONS" in the manual.

Andy
Reply With Quote
  #3 (permalink)  
Old 02-03-10, 10:26
stolze stolze is offline
Registered User
 
Join Date: Jan 2007
Location: Jena, Germany
Posts: 2,662
Use a forward slash. That's the path separator on unix systems, and Windows understands that as well.
__________________
Knut Stolze
IBM DB2 Analytics Accelerator
IBM Germany Research & Development
Reply With Quote
  #4 (permalink)  
Old 02-03-10, 10:45
Howardw Howardw is offline
Registered User
 
Join Date: Nov 2009
Posts: 18
Thanks for the Help - i worked out what I needed to do - answer below

On the CLP command line

to get output to file from windows vista
!db2 connect to stage1 user blue using xxxx;
!db2 select * from stag1.grade > "l:boots\testx.txt"
Reply With Quote
  #5 (permalink)  
Old 02-03-10, 10:46
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
I think Howardw tries to redirect query output from within CLP, so no amount of slashes will help.

@Howardw, this can be done from the command line:

db2 "select * from table1">C:\mydir\output.txt

or

db2 -r C:\mydir\output.txt "select * from table1"
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On