Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2010
    Posts
    3

    Unanswered: Combine SELECT * with literal

    A requirement for a trigger is to select all the columns of TableA and attach a literal 'S' as the first column. Basic example is:

    SELECT 'S', Col1, Col2, Col3, etc
    FROM TableA

    However, TableA has close to 300 columns which change slightly every couple months. For ease of maintenence another requirement is to use "SELECT *" rather than specifying all the columns.

    If/how could this be accomplished?

    Thanks.

  2. #2
    Join Date
    Jun 2010
    Posts
    3
    This appears to work...

    SELECT *
    FROM
    (SELECT 'S' FROM SYSIBM.SYSDUMMY1) Q1,
    (SELECT * FROM TableA) Q2

  3. #3
    Join Date
    Feb 2008
    Location
    Japan
    Posts
    3,483
    Please try
    Code:
    SELECT 'S'
         , t.*
     FROM  TableA AS t

Posting Permissions

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