1 Replies - 2668 Views - Last Post: 23 April 2012 - 09:16 AM

#1 DanDeCoder  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 30
  • Joined: 18-October 10

Invalid Field Definition 'Child_ID' in definition of index or

Posted 23 April 2012 - 08:06 AM

Hi Guys,

Can anyone point me in the right direction here please?
My database is 99% complete, I've managed to build all tables using SQL however when trying to build the table below, I'm seeing this error message: Invalid field definition 'Child_ID' in definition of index or relationship.

Here's the SQL for the table I want to create:

CREATE TABLE Meal(
Meal_ID int NOT NULL,
MealType TEXT(20),
MealDate TEXT(20),
FOREIGN KEY (Child_ID) REFERENCES Child(Child_ID)); 


Here's the code from the 'Child' table where the Child ID PK is located. There are other tables with the Child ID FK but I've tried those. I did read somewhere that it may be a location issue but I can't for the life of me spot the error.

CREATE TABLE Child(
Child_ID int NOT NULL,
FirstName TEXT(20),
SecondName TEXT(20),
DateOfBirth TEXT(20),
PRIMARY KEY (Child_ID)); 


Thanks once again!

Is This A Good Question/Topic? 0
  • +

Replies To: Invalid Field Definition 'Child_ID' in definition of index or

#2 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 9214
  • View blog
  • Posts: 34,610
  • Joined: 12-June 08

Re: Invalid Field Definition 'Child_ID' in definition of index or

Posted 23 April 2012 - 09:16 AM

Have you tried setting 'Meal_ID' as a primary key?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1