Check value at insert
Posted
by ThreeFingerMark
on Stack Overflow
See other posts from Stack Overflow
or by ThreeFingerMark
Published on 2010-04-05T21:26:54Z
Indexed on
2010/04/05
21:33 UTC
Read the original article
Hit count: 256
Hello, i have this three tables.
Table: Item
Columns: ItemID, Title, Content, NoChange (Date)
Table: Tag
Columns: TagID, Title
Table: ItemTag
Columns: ItemID, TagID
In the Item Table is a Field with NoChange, if this field = true no Tag is allowed to insert a ItemTag value with this ItemID. How can i check this in the insert?
For Updates i have this Statement:
UPDATE ItemTag SET TagID = ? where ItemID = ?
AND TagID = ? AND exists (
select ItemID from Item where ItemID = ? AND NoChange is null)");
Thank you.
© Stack Overflow or respective owner