Results 1 to 4 of 4
  1. #1
    Join Date
    Nov 2010
    Posts
    2

    Unanswered: finding all the identity column in DB2

    how can we get all the existing identity and sequences in a database in DB2. we can use 2 different queries to find each one. Please help.

  2. #2
    Join Date
    Dec 2007
    Location
    Richmond, VA
    Posts
    1,328
    Provided Answers: 5
    have you tried UNION?

  3. #3
    Join Date
    Nov 2010
    Posts
    2
    SELECT TABNAME, COLNAME FROM SYSCAT.COLUMNS WHERE IDENTITY = 'Y'

    The above query gives all the table name and column name which has column as identity..
    Any way thanks for ur consideration..

  4. #4
    Join Date
    Dec 2007
    Location
    Richmond, VA
    Posts
    1,328
    Provided Answers: 5
    yes it does. Your other query gets the sequences I take it from your original mail. You want to run one query that gets them both at once and as I said try UNION

    select cols from table1 where ....
    UNION
    select cols from table2 where...

    Just ensure the columns match up with data type between the two queries.
    Dave

Posting Permissions

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