Results 1 to 4 of 4
  1. #1
    Join Date
    Nov 2003
    Posts
    17

    Unanswered: keeping integrity

    Hi,

    I have two tables that both contain integer fields that are to be used as unique identifiers. These tables, and fields, will only ever be updated manually. The issue I have is that a value assigned to one of these fields in one table cannot be assigned to the same field in the other. Thus, if 24 is assigned to this field in table A it cannot then be assigned to the same field in table B. Is there anyway to enforce this rule in DB2, without having to create additional lookup tables etc?

    Thanks for any help

    Richard

  2. #2
    Join Date
    Aug 2001
    Location
    UK
    Posts
    4,650

    Re: keeping integrity

    A SEQUENCE Object

    http://www-106.ibm.com/developerwork...2fielding.html

    http://www-106.ibm.com/developerwork...05pilaka2.html

    Cheers
    Sathyaram

    Originally posted by Rdean
    Hi,

    I have two tables that both contain integer fields that are to be used as unique identifiers. These tables, and fields, will only ever be updated manually. The issue I have is that a value assigned to one of these fields in one table cannot be assigned to the same field in the other. Thus, if 24 is assigned to this field in table A it cannot then be assigned to the same field in table B. Is there anyway to enforce this rule in DB2, without having to create additional lookup tables etc?

    Thanks for any help

    Richard
    Last edited by sathyaram_s; 01-05-04 at 09:55.
    Visit the new-look IDUG Website , register to gain access to the excellent content.

  3. #3
    Join Date
    Jun 2002
    Location
    UK
    Posts
    525
    Or maybe an identity column. Start one at 1, the other at 2 and increment both by 2 (so one table has even number id column and the other, odd).

  4. #4
    Join Date
    Nov 2003
    Posts
    17
    Thanks for the suggestions guys, but I think I am going to go with option C.... a subtle bit of database redesign

    Thanks again!!

Posting Permissions

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