The problem is that when I load the data using LOAD DATA LOCAL INFILE, I get this error:
ERROR 1216 (23000): Cannot add or update a child row: a foreign key constraint fails
That seems clear enough except that the foreign key constraint should *not* fail. I've verified that the value exists in the other table.
What is really strange is that when I tried inserting the data directly using "INSERT INTO", it works. In this particular case, I only need to load a handful of records, so using INSERT INTO is an option, but I would really like to figure out what isn't working.
Here is my table definition:
create table Subscriber (
UserID int auto_increment,
Name varchar(50) not null,
Password varchar(8) not null,
EmailAddress varchar(50),
SGroupName varchar(50),
primary key (UserId),
foreign key (SGroupName) references AccessGroup(GroupName) on update cascade
) ENGINE=INNODB;
Here is how I am attempting to load it:
LOAD DATA LOCAL INFILE 'c:/Documents and Settings/john/My Documents/Grad School/Project/LoadData/Subscriber.csv'
REPLACE
INTO TABLE Subscriber
FIELDS TERMINATED BY ','
OPTIONALLY ENCLOSED BY '"'
ESCAPED BY '\\'
LINES TERMINATED BY '\r\n'
IGNORE 1 LINES
(Name, Password, EmailAddress, SGroupName);
Here are the first two lines of my data file:
Name, Password, EmailAddress, SGroupName "John Swartzentruber", "8490JTTT", "[EMAIL PROTECTED]", Administrator
And here is what *does* work:
insert into Subscriber
(Name, Password, EmailAddress, SGroupName)
values ("John Swartzentruber", "8490JTTT", "[EMAIL PROTECTED]", "Administrator");
Can anyone see what my problem is? I really appreciate any assistance you can provide. I hope this is the appropriate group for newbie questions.
-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]