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 > DB2 UDB SQL Prepend a literal on export statement

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-05-07, 16:19
oakwoodman oakwoodman is offline
Registered User
 
Join Date: Feb 2007
Posts: 4
DB2 UDB SQL Prepend a literal on export statement

I have the following

export to a.txt of del modified by coldel| messages a.msg
select *
from b_table
where b_table.nbr =any
(select c_nbr from c_table);

This statement works fine.

What I would like to do is prepend a literal to each export record.

I can achieve this by doing the following on the first select:

select 'x', nbr, .........

But is there a way to do this without naming all the fields on the select statement?
Reply With Quote
  #2 (permalink)  
Old 02-05-07, 16:35
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
Quote:
Originally Posted by oakwoodman
I have the following

export to a.txt of del modified by coldel| messages a.msg
select *
from b_table
where b_table.nbr =any
(select c_nbr from c_table);

This statement works fine.

What I would like to do is prepend a literal to each export record.

I can achieve this by doing the following on the first select:

select 'x', nbr, .........

But is there a way to do this without naming all the fields on the select statement?

I think you want something like:

export to a.txt of del modified by coldel| messages a.msg
select 'x', b.*
from b_table as b
where b.nbr =any
(select c_nbr from c_table);


Andy
Reply With Quote
  #3 (permalink)  
Old 02-06-07, 05:01
oakwoodman oakwoodman is offline
Registered User
 
Join Date: Feb 2007
Posts: 4
Thanks Andy, your suggestion worked just fine.
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