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 > Informix > unload data of two items to one file

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-23-10, 07:54
tomjones1980 tomjones1980 is offline
Registered User
 
Join Date: Apr 2010
Posts: 3
unload data of two items to one file

Hi
i want to use the unload command to unload data of two or more items,but the data must go to one file.How can i do this.

sample that i use:
unload to b.txt select * from table where item='pea';
unload to b.txt select * from table where item='corn';
i need both outputs in the b.txt file.
But what happens is that the second one overwrites the first one.

Please help
Reply With Quote
  #2 (permalink)  
Old 04-23-10, 08:46
mjldba mjldba is offline
Registered User
 
Join Date: Dec 2003
Location: North America
Posts: 139
AIX / UNIX solution

I'd unload data to a.txt and b.txt then append the contents of one file to another

cat a.txt >> b.txt
Reply With Quote
  #3 (permalink)  
Old 04-23-10, 11:04
bigcalm bigcalm is offline
Registered User
 
Join Date: Jul 2009
Posts: 37
Alternatively, just union the 2 queries together...

unload to b.txt
select * from table where item='pea'
union all
select * from table where item='corn';
Reply With Quote
  #4 (permalink)  
Old 04-23-10, 11:51
mjldba mjldba is offline
Registered User
 
Join Date: Dec 2003
Location: North America
Posts: 139
Another method would be

unload to b.txt select * from table where item in ('pea','corn');
Reply With Quote
  #5 (permalink)  
Old 04-25-10, 17:42
tomjones1980 tomjones1980 is offline
Registered User
 
Join Date: Apr 2010
Posts: 3
Thank you for the response, but i have a limitation when i use this option,i can't use it to unload more than 6,000 records. i need a method that can unload about 100,000 records.
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