Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2005

    Unanswered: Query null/not null constraints from system tables?

    I'm using ASE 12.5 on Solaris. I need to query the system tables to determine null/not null constraints for each column of various tables.

    I've been able to query the other thing I need (data types of each column for various tables) from systypes, syscolumns, and sysobjects, but I can't find where the null/not null constraints are stored.


  2. #2
    Join Date
    Dec 2005
    I found some encouraging info in the Sybase docs for the syscolumns table, but I'm still a bit confused.

    If status = 8, then NULLs are allowed in the column. But does this automatically mean that if status != 8, then NULLs are NOT allowed? For example, if status = 16 does it mean that NULLs are allowed or not?


    Table = syscolumns
    Column = status
    Bits 0-2 (values 1, 2, and 4) indicate bit positioning if the column uses
    the bit datatype. If the column uses the text/image datatype, bits 0 and 1
    indicate replication status as follows:
        * 01 = always replicate
        * 10 = replicate only if changed
        * 00 = never replicate
    Bit 3 (value 8) indicates whether NULL values are legal in this column.
    Bit 4 (value 16) indicates whether more than one check constraint exists for the column.
    Bits 5 and 6 are used internally.
    Bit 7 (value 128) indicates an identity column.
    Bit 8 is unused.

  3. #3
    Join Date
    May 2005
    South Africa
    Provided Answers: 1

    bitmap check

    You’ll have to check for
    status & 8 = 8

Posting Permissions

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