Hi All,
[highlight #204A87]Want to update a column based on 2 columns at Table level and would like some help.[/highlight]
Error: constraint clause
How to UPDATE columnn RightId_Chk to value 'Y' only when
RightId is Not Null and WrongId is null
or is there another way to achieve this condition.
Thanks,
IT-Tech
[highlight #204A87]Want to update a column based on 2 columns at Table level and would like some help.[/highlight]
Code:
Current Table structure: tblCheckId
RightId text(25), WrongId text(25), RightId_chk text(1)
Indexes in TblCheckId:
Indx1 is RightId+RightId_Chk in this combination Unique as Yes
Indx2 is WrongId Unique as Yes
Value in table: tblCheckId
RightId WrongId RightId_Chk
Material1 Y
Material1 mtrl1
Material1 Mtrial1
[b]Gives error in below sql:[/b]
ALTER table tblCheckId
ADD constraint (RightId is not null AND
WrongId is null references tblcheckid
on UPDATE SET RightId_chk ="Y")
Error: constraint clause
How to UPDATE columnn RightId_Chk to value 'Y' only when
RightId is Not Null and WrongId is null
or is there another way to achieve this condition.
Thanks,
IT-Tech