Jim, Monday, August 19, 2002, 3:19:36 PM, you wrote: JB> Following are two CREATE TABLE statements. The second one fails because of JB> an error in the last line.
JB> Does anyone know why? JB> STATEMENT #2 JB> CREATE TABLE IID_InventoryItemDesc( JB> IID_ItemDescCD VARCHAR(1) NOT NULL, JB> IID_ItemDesc VARCHAR(24), JB> IID_RecordCreatedBY VARCHAR(24), JB> IID_RecordCreatedDT DATETIME, JB> IID_LastEditBY VARCHAR(24), JB> IID_LastEditDT DATETIME, JB> PRIMARY KEY(IID_ItemDescCD), JB> KEY (IID_ItemDesc), JB> CONSTRAINT IIM_TO_IID FOREIGN KEY IIM_InventoryItemMaster JB> (IIM_ItemDescCD) JB> REFERENCES IIM_InventoryItemDesc( JB> Primary key) MATCH FULL); 1. You use wrong syntax for foreign key. Please, check the manual for the right syntax: http://www.mysql.com/doc/en/SEC447.html 2. There is no field called 'Primary key' in the table IIM_InventoryItemDesc. 3. If you want to use foreign key your both tables must be InnoDB. -- For technical support contracts, goto https://order.mysql.com/?ref=ensita This email is sponsored by Ensita.net http://www.ensita.net/ __ ___ ___ ____ __ / |/ /_ __/ __/ __ \/ / Egor Egorov / /|_/ / // /\ \/ /_/ / /__ [EMAIL PROTECTED] /_/ /_/\_, /___/\___\_\___/ MySQL AB / Ensita.net <___/ www.mysql.com --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php