How to add a constraint on SQL Server 2008 using the constraint dialog?

How do you manually define a constraint in the SQL Server 2008 dialog box? I want to add a restriction when I add a new record, if it is not already there. My table is structured so that

AdvCatJoinID- this is my primary key, CatID- this is the key from the table Category, and AliasID- the primary key from the alias table. I want the restriction to be such that if CatIDthey AliasIDalready exist in the table as a pair, then they do not add a new record (as it already exists), how?

thank

+3
source share
2 answers

Step 1:

SQL Server , , Indexes , New Index:

enter image description here

2:

:

  • , [ X ] Unique.
  • [ Add ],

enter image description here

, (CatID, AliasID), .

+2

AdvCatJoinID? 2 . .

SSMS "/" ( ) . "", .

, , " ", .

+2

Source: https://habr.com/ru/post/1792114/


All Articles