Hi I can't find the proper sql syntax for defining the FK. I'm creating two tables; customers and orders. In the orders tables the cust_ID is the FK. Well, I thought the syntax below was correct but it wasn't accepted when I ran the Create Orders Table statement. If this is not the proper FK reference can someone tell me what is? I've looked every where. I want to use strict sql and avoid any query builders and such. I can't find any good access sql syntax resources either.
Thank You.
-v2007
The customer table:
Create Table Customers
(
Cust_ID int NOT NULL Primary Key,
LastName varchar(20) NOT NULL,
FirstName varchar(20),
Street varchar(40),
State char(2),
Phone varchar(15),
PostCode varchar(20)
);
The Orders Table:
Create Table Orders
(
Ord_ID int NOT NULL Primary Key,
OrderNO int NOT NULL,
ShippedVia varchar(30),
ShipAddress varchar(55),
ShipCity varchar(30),
ShipRegion varchar(1),
DateOfDelivery DATETIME,
Cust_ID int Foreign Key References Customers(Cust_ID)
);
The error high-lights the keyword 'Foreign' as when I run it. But there's no problem creating the customer table.