insert thing

insert thing

 

  

Hi All


I think my brains in advanced ready to go on holiday mode so some help would
be appreciated


Got this table ..

drop table simon1
go

create table simon1

(
c1 int,
c2 int
)

alter table simon1
add constraint ck_test2 check (c1 <> c2)

CREATE unique INDEX ICX_simon_left ON simon1(c1,c2)
CREATE unique INDEX ICX_simon_right ON simon1(c2,c1)
go

insert simon1 (c1,c2)
values ('1','2')

insert simon1 (c1,c2)
values ('5','6')

insert simon1 (c1,c2)
values ('6','5')


The final "constraint" I want to be able to apply is if 5,6 exists already
I want it to fail if the user tries to insert 6,5

Any wonderful suggestions gratefully received (go on ed you can do it )


~si

MS Sql Server LazyDBA home page