• arr.nagaraj (4/1/2009)


    insert into t3(n1,n2) values (10,11);

    insert into t3(n2,n1) values (11,10);

    These two statements are semantically the same.

    You probably wanted to write this instead:

    insert into t3(n1,n2) values (10,11);

    insert into t3(n1,n2) values (11,10);

    Another possible solution to this requirement might be ("might" because I don't know the business problem):

    CREATE TABLE dbo.t3 (

    n1 int NOT NULL

    ,n2 int NOT NULL

    ,CONSTRAINT UQ_t3 UNIQUE (n1, n2)

    ,CONSTRAINT CK_t3_n1_LE_n2 CHECK (n1<=n2)

    );

    Best Regards,

    Chris Büttner