Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2007
    Posts
    4

    Unanswered: 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?

  2. #2
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    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

  3. #3
    Join Date
    Feb 2007
    Posts
    4
    Thanks Andy, your suggestion worked just fine.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •