Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Other Forums
 Other Topics
 CONTRAINT syntax + Normalization

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-05-14 : 00:03:16
jonathan writes "everybody says normalize normalize your database tables, but i need a working example. i have 3 tables:

CREATE TABLE tCustomers (
iCustomerID COUNTER,
sLastName TEXT(50),
sFirstName TEXT(50)
)

CREATE TABLE tProducts (
iProductID COUNTER,
sProduct TEXT(50),
cPrice CURRENCY
)

CREATE TABLE tOrders (
iOrderID COUNTER,
iCustomerID INTEGER,
iProductID INTEGER,
dDate DATE,
dTime TIME,
CONSTRAINT fkCustomerID FOREIGN KEY (iCustomerID) REFERENCES tCustomers (iCustomerID) ON UPDATE CASCADE ON DELETE CASCADE,
CONSTRAINT fkProductID FOREIGN KEY (iProductID) REFERENCES tProducts (iProductID) ON UPDATE CASCADE ON DELETE CASCADE
)

and all i get is

"No unique index found for the referenced field of the primary table."

thanx."
   

- Advertisement -