Albert,

This column would have duplicate data so can you just use the following
command

ALTER TABLE Customers ALTER COLUMN CustName NOT NULL

Steve

-----Original Message-----
From: Albert Berry [mailto:[EMAIL PROTECTED]
Sent: Thursday, September 15, 2005 12:03 PM
To: [email protected]
Subject: [RBG7-L] - Re: Constraints


Steve, here is a short review of constraints.

PRIMARY KEY - Allows neither NULLs nor duplicate values. It is used as a
reference from FOREIGN KEY. 

When the FOREIGN KEY is active, only values in the PRIMARY KEY are allowed.
NULLs are allowed unless the FOREIGN KEY column is expressly constrained as
NOT NULL. 

A UNIQUE constraint may be applied where a column other than the PRIMARY KEY
needs to have no duplicates. UNIQUE requires NOT NULL - you can have no
nulls
in PRIMARY KEYS or in UNIQUE constraints.

Here are the commands:

ALTER TABLE Customers ALTER COLUMN CustID NOT NULL PRIMARY KEY

ALTER TABLE CustomerNotes ALTER COLUMN CustID NOT NULL REFERENCES Customers

ALTER TABLE Customers ALTER COLUMN CustName NOT NULL UNIQUE


--- Steve Breen <[EMAIL PROTECTED]> wrote:

>  
> 
> I have never worked with constraints and need to put a constraint on the
> column (Doornam) in a master
> 
> Any assistance would be appreciated
> 
>  
> 
>  
> 
> Stephen Breen
> 
> CDI Services, Inc.
> 
>  
> 
>  
> 
> 


Albert Berry 
Management Consultant
RR2 - 1252 Ponderosa Drive
Sparwood BC, V0B 2G2 
Canada
(250) 425-5806
(250) 425-7259
(708) 575-3952 (fax)
[EMAIL PROTECTED]

Reply via email to