I have the following three tables:
Form
-----------
formId INTEGER PK
name NVARCHAR(50) NOT NULL
Block
-----------
blockId INTEGER PK
name NVARCHAR(30) NOT NULL
orderInForm INTEGER NOT NULL
FormBlock
-----------
blockId INTEGER PK
formId INTEGER PK
There is a many-to-many relationship. A block could appear on multiples forms. orderInForm is for a particular form.
On Block table I want to avoid that two blocks have the same orderInForm in a Form.
I think I have to add an UNIQUE constraint, but if orderInForm is on Block table, I don't know how to do it.
May I need to move orderInForm to FormBlock table?
orderInFormbe for a particular form? Or should it apply to all forms? – Justin Cave May 8 '12 at 6:26orderInFormis for a particular form. I will add this to my question to clarify. – VansFannel May 8 '12 at 6:30