Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2008
    Posts
    1

    Unanswered: Can a database name in a select statement be a variable

    Hello
    Is there a way to use information in a column in one table and that info is part of a table name I need to access using a select statement?

    Example:
    Table one contains a column of item numbers.
    My next select statement would be
    Select *
    From xxx(item number)xx
    Where ......

    This on a Z/os system

    Any help would be greatly appreciated

    Thanks
    Frank

  2. #2
    Join Date
    Dec 2005
    Posts
    273
    in a single statement, that's not possible.

  3. #3
    Join Date
    Jan 2007
    Location
    Jena, Germany
    Posts
    2,721
    You need dynamic SQL for that.
    Knut Stolze
    IBM DB2 Analytics Accelerator
    IBM Germany Research & Development

Posting Permissions

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