By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,933 Members | 1,676 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,933 IT Pros & Developers. It's quick & easy.

cross-table unique constraint

P: n/a
Is it possible to create a unique constraint on multiple fields in
related tables?

Randall

Nov 12 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On Tue, Jan 06, 2004 at 07:10:28 +0000,
Randall Smith <ra*****@tnr.cc> wrote:
Is it possible to create a unique constraint on multiple fields in
related tables?


Not with the normal UNIQUE constraint. That will do multiple columns in
one table, but won't span tables.

You can probably do what you want using triggers.

---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Nov 12 '05 #2

P: n/a
So how might I go about doing this.

3 tables: a, b, and c

When these 3 tables are joined, there is a combination of 3 fields, one
field from each table, that should be unique.

Should there be a trigger that checks this condition on inserts/updates
on each of these tables?

Randall

Bruno Wolff III wrote:
On Tue, Jan 06, 2004 at 07:10:28 +0000,
Randall Smith <ra*****@tnr.cc> wrote:
Is it possible to create a unique constraint on multiple fields in
related tables?

Not with the normal UNIQUE constraint. That will do multiple columns in
one table, but won't span tables.

You can probably do what you want using triggers.

---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings


Nov 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.