Results 1 to 7 of 7
  1. #1
    Join Date
    May 2002
    Posts
    73

    Unanswered: table constraints

    People:

    How I can edit or have a view of the constraints for certain table ??

    I have some probles with a table were it is supposed to not accept duplicated values for one field and I don´t know why it fails.


    Regards,

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

    Re: table constraints

    Check whether there is a row for the table in syscat.tabconst .

    Cheers

    Sathyaram

    Originally posted by jeremas
    People:

    How I can edit or have a view of the constraints for certain table ??

    I have some probles with a table were it is supposed to not accept duplicated values for one field and I don´t know why it fails.


    Regards,

  3. #3
    Join Date
    May 2002
    Posts
    73

    table constraints.

    Yes there is only one row for such table.


    How I could know what it means?

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

    Re: table constraints.

    Here is the description of the columns of the view ... if this is not clear post the contents of this view here :



    CONSTNAME VARCHAR(18)
    Name of the constraint (unique within a table).

    TABSCHEMA VARCHAR(128)
    Qualified name of the table to which this
    constraint applies.

    TABNAME VARCHAR(128)

    DEFINER VARCHAR(128)
    Authorization ID under which the constraint
    was defined.

    TYPE CHAR(1)
    Indicates the constraint type:
    F = FOREIGN KEY
    K = CHECK
    P = PRIMARY KEY
    U = UNIQUE

    REMARKS VARCHAR(254)
    Yes User-supplied comment, or null.

    Originally posted by jeremas
    Yes there is only one row for such table.


    How I could know what it means?
    Last edited by sathyaram_s; 08-01-02 at 19:19.

  5. #5
    Join Date
    May 2002
    Posts
    73

    constraints

    I have the next:

    CONSTNAME VARCHAR(18)
    SQL001103003746580

    TABSCHEMA VARCHAR(128)
    EPDD

    TABNAME VARCHAR(128)

    T28_CARTAS

    DEFINER VARCHAR(128)
    User authirized

    TYPE CHAR(1)
    P


    REMARKS VARCHAR(254)
    null.

    With such info, How do I know what it does??

    My problem is that I have a field which is the number of a card. The customer tryies to apply his card and it should be applied only once. Sometimes customers apply the same card more than once.

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

    Re: constraints

    The type 'P' represents a Primary Key .

    To check which columns are in the primary key , do a select on syscat.keycoluse using either the tabschema/tabname or constname ...

    This will show you whether the card number column is a primary key column or not ...

    Remember, if more than one column is involved in the primary key, it is the combination of the columns that is unique.

    HTH

    Cheers

    Sathyaram



    Originally posted by jeremas
    I have the next:

    CONSTNAME VARCHAR(18)
    SQL001103003746580

    TABSCHEMA VARCHAR(128)
    EPDD

    TABNAME VARCHAR(128)

    T28_CARTAS

    DEFINER VARCHAR(128)
    User authirized

    TYPE CHAR(1)
    P


    REMARKS VARCHAR(254)
    null.

    With such info, How do I know what it does??

    My problem is that I have a field which is the number of a card. The customer tryies to apply his card and it should be applied only once. Sometimes customers apply the same card more than once.

  7. #7
    Join Date
    Jan 2002
    Location
    Manila, Philippines
    Posts
    71

    try DB2LOOK

    although you can't exactly specify that you only want to list table constraints ... you can get the table DDL which constains constraint definition in a more 'understandable' format.

    HTH,
    Oliver

Posting Permissions

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