CHECK CONSTRAINT + Which doctor is good to check?

  • All,

    I am not feeling well.so i wanted to know whom should i contact to get good tablets. Also if anybody suggest some good tablets it will be good. 🙂

    Doctor 1:

    create table t1

    (

    eno char(2) COLLATE SQL_Latin1_General_Cp437_CS_AS not null constraint c1 Check ( eno like '[A-Z][A-Z]')

    )

    insert into t1 values ('Aa')

    insert into t1 values ('AA')

    Doctor 2:

    create table departments

    ( location CHAR(2) COLLATE SQL_Latin1_General_Cp437_CS_AS not null constraint D_LOC_CHK check (location = upper(location))

    )

    insert into departments values ('Aa')

    insert into departments values ('AB')

    Good Tablets are welcome!

    🙂

    karthik

  • Your departments table will allow the following:

    insert into departments values ('12')

    I'm guessing you only want it to allow uppercase characters A-Z?

  • you can specify the collation in a LIKE clause.

    Best wishes,
    Phil Factor

  • The Happy Pill

    [font="Courier New"]

    CREATE TABLE t1

    (

    eno CHAR(2) COLLATE SQL_Latin1_General_Cp437_CS_AS NOT NULL

       CONSTRAINT c1 CHECK

       ( eno LIKE

       '[ABCDEFGHIJKLMNOPQRSTUVWXYZ][ABCDEFGHIJKLMNOPQRSTUVWXYZ]'

       COLLATE SQL_Latin1_General_Cp437_CS_AS)

    )

    INSERT INTO t1 VALUES ('dF')

    INSERT INTO t1 VALUES ('AA')[/font]

    Best wishes,
    Phil Factor

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply