Re: constraints on views

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: AnthonyThomas (Anthony.Thomas_at_CommerceBank.com)
Date: 12/30/04


Date: Thu, 30 Dec 2004 07:57:08 -0600

You could also consider a UNIQUE CONSTRAINT on the combination of a, b, and
c. What is the rule when c <> 1?

Sincerely,

Anthony Thomas

-- 
"Agoston Bejo" <gusz1@freemail.hu> wrote in message
news:evpzFRF2EHA.3408@tk2msftngp13.phx.gbl...
Hi.
At first let me present the problem:
T(a int, b int, c bit)
I would like to see to it that (a,b) is unique where c = 1. The easiest way
to accomplish this would be creating a view like this:
create view V as select a,b from T where c = 1
And then putting a unique constraint on (a,b) in V.
I am open to other solutions as well, of course.
Thx,
Agoston


Relevant Pages

  • Re: Surrogate Key
    ... The below is what I use, you notice that the INT column named ID has the ... IDENTITY property and has a UNIQUE constraint defined upon it, also, the ... CONSTRAINT UNIQUE CLUSTERED ... individual_id int not null references individual(id), ...
    (microsoft.public.sqlserver.programming)
  • Re: constraints on views
    ... Anthony Thomas ... T(a int, b int, c bit) ... The easiest way to accomplish this would be creating a view like this: create view V as select a,b from T where c = 1 And then putting a unique constraint on in V. ...
    (microsoft.public.sqlserver.programming)
  • constraints on views
    ... T(a int, b int, c bit) ... to accomplish this would be creating a view like this: ... And then putting a unique constraint on in V. ... Thx, ...
    (microsoft.public.sqlserver.programming)
  • constraints on views
    ... T(a int, b int, c bit) ... to accomplish this would be creating a view like this: ... And then putting a unique constraint on in V. ... Thx, ...
    (microsoft.public.sqlserver.server)