Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2006
    Posts
    13

    Unanswered: Check for column extistance

    Hey All,

    I'm hoping you might be able to help me out with a problem I'm having.
    I was wondering if there is syntax for checking if a column exist. I have to do migration e.g.
    Code:
    insert into TBLone(
    a
    ,b
    ,c
    ,d
    ,e
    ,F
    )
    select
    a
    ,b
    ,c
    ,d
    ,e
    ,F
    From TBLtwo!
    My problem is that in "TBLtwo" the column "f" may not exist, so I would want to do the migration if it does exist but if it doest not skip it e.g

    Code:
    if column F exists
       migrate data from TBLtwo.F into TBLone.F
    else
       Skip migration of that column
    Anyone got any suggestions or if I didn't explain that well just shout
    Thanks.

  2. #2
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    The column definitions for every table is contained in the DB2 Catalog. See SQL Reference, Vol 1, Appendix D, Catalog Views.
    M. A. Feldman
    IBM Certified DBA on DB2 for Linux, UNIX, and Windows
    IBM Certified DBA on DB2 for z/OS and OS/390

  3. #3
    Join Date
    Nov 2006
    Posts
    13
    Excellent thanks for the info

Posting Permissions

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