Jump to content

Archived

This topic is now archived and is closed to further replies.

Conjurer

Data file load to table - can only get one row.

Recommended Posts

I am totally lost on this and have been spinning my wheels all day.

I have a table. I have a data file with 1145 records. I want to load the data into the table.

 

I have tried creating a small test with just 6 records in it. It is a csv file.

 

When I try to load it into the table it says it loaded 6 records but only one is in there.

 

Any clues what I am doing wrong? :?

 

A couple things I am wondering about is whether my Primary Key or any of the other keys would goof me up. Also the data I am loading is only the first dozen fields the others are not be used.

 

I used a list of columns with comma separation to tell it which fields.

 

Here is a sample of the text file data I am trying to load:

1,Maryann,Johnson,Clinical Contact,\"Billing Solutions, Etc, Inc\",\"2850 Southwest Cedar Hills Boulevard, Pmb 64\",,,River City,OR,97501,,503-644-8931,503-646-8931,,,,,2k1D15

2,Stephanie,Olhausen,Clinical Contact,\"Paul Puziss, M.D.\",3800 SW CEDAR HILLS BLVD,,,River City,OR,97501,SUITE #250-WESTGATE PLAZA,503-646-8931,503-644-8931,503-526-8931,,,,2c2u82

3,Kenny,Goerig,Optical Director,Sunset Eye Clinic,\"1865 NW 169 Place, Suite 105\",,,River City,OR,97501,,(503) 533-8931,(503) 533-8931,,,xyz@xyz.com,www.xyz.com,2d3N57

4,Jacob,Janecek,Optometric Physician,Sunset Eye Clinic,\"1865 NW 169 Place, Suite 105\",,,River City,OR,97501,,(503) 533-8931,(503) 533-8931,,,xyz@xyz.com,www.xyz.com,2k4p84

5,Samuel,Lee,Optometric Physician,Sunset Eye Clinic,\"1865 NW 169 Place, Suite 105\",,,River City,OR,97501,,(503) 533-8931,(503) 533-8931,,,xyz@xyz.com,www.sunseteyeclinic.com,2E5z6

 

 

Here is a dump of the table:

 

# phpMyAdmin SQL Dump

# version 2.5.2

# http://www.phpmyadmin.net

#

# Host: localhost

# Generation Time: Oct 27, 2003 at 05:39 PM

# Server version: 4.0.15

# PHP Version: 4.2.3

#

# Database : `immedia_Contacts`

#

 

# --------------------------------------------------------

 

#

# Table structure for table `Marketing`

#

# Creation: Oct 27, 2003 at 04:46 PM

# Last update: Oct 27, 2003 at 04:51 PM

#

 

CREATE TABLE `Marketing` (

`Userid` int(25) NOT NULL auto_increment,

`First_Name` varchar(25) NOT NULL default \'\',

`Last_Name` varchar(25) NOT NULL default \'\',

`Title` varchar(25) NOT NULL default \'\',

`Company` varchar(40) NOT NULL default \'\',

`Address_Line_1` varchar(60) NOT NULL default \'\',

`Address_Line_2` varchar(60) NOT NULL default \'\',

`Address_Line_3` varchar(60) NOT NULL default \'\',

`City` varchar(25) NOT NULL default \'\',

`State` char(2) NOT NULL default \'\',

`Zip_Code` varchar(10) NOT NULL default \'\',

`2nd_Address` varchar(60) NOT NULL default \'\',

`Phone` varchar(25) NOT NULL default \'\',

`Fax` varchar(25) NOT NULL default \'\',

`Phone_1` varchar(25) NOT NULL default \'\',

`Phone_2` varchar(25) NOT NULL default \'\',

`Email` varchar(25) NOT NULL default \'\',

`Web_Page` varchar(25) NOT NULL default \'\',

`Confirmation_Code` varchar(25) NOT NULL default \'\',

`Prd_Imaging` set(\'Y\',\'N\') NOT NULL default \'N\',

`Prd_EMR` set(\'Y\',\'N\') NOT NULL default \'N\',

`Prd_Appt_Schd` set(\'Y\',\'N\') NOT NULL default \'N\',

`Prd_Billing` set(\'Y\',\'N\') NOT NULL default \'N\',

`Prd_AR_Finan` set(\'Y\',\'N\') NOT NULL default \'N\',

`Prd_Docuscan` set(\'Y\',\'N\') NOT NULL default \'N\',

`Demo_Will_Attnd` set(\'Y\',\'N\') NOT NULL default \'N\',

`Contact_Has_Questions` set(\'Y\',\'N\') NOT NULL default \'N\',

`Contact_Prsnl_Info` text NOT NULL,

`Username` varchar(25) NOT NULL default \'\',

`Password` varchar(255) NOT NULL default \'\',

`User_Level` enum(\'0\',\'1\',\'2\',\'3\') NOT NULL default \'0\',

`Signup_Date` datetime NOT NULL default \'0000-00-00 00:00:00\',

`Last_Login` datetime NOT NULL default \'0000-00-00 00:00:00\',

`Activated` enum(\'0\',\'1\') NOT NULL default \'0\',

PRIMARY KEY (`Userid`),

UNIQUE KEY `Email` (`Email`),

UNIQUE KEY `Username` (`Username`),

KEY `Names` (`Last_Name`,`First_Name`),

KEY `Company` (`Company`),

KEY `Confirmation_Code` (`Confirmation_Code`)

) TYPE=MyISAM COMMENT=\'Master List of Immedia Prospects\' AUTO_INCREMENT=8 ;

 

#

# Dumping data for table `Marketing`

#

 

INSERT INTO `Marketing` (`Userid`, `First_Name`, `Last_Name`, `Title`, `Company`, `Address_Line_1`, `Address_Line_2`, `Address_Line_3`, `City`, `State`, `Zip_Code`, `2nd_Address`, `Phone`, `Fax`, `Phone_1`, `Phone_2`, `Email`, `Web_Page`, `Confirmation_Code`, `Prd_Imaging`, `Prd_EMR`, `Prd_Appt_Schd`, `Prd_Billing`, `Prd_AR_Finan`, `Prd_Docuscan`, `Demo_Will_Attnd`, `Contact_Has_Questions`, `Contact_Prsnl_Info`, `Username`, `Password`, `User_Level`, `Signup_Date`, `Last_Login`, `Activated`) VALUES (7, \'Charles\', \'Mcbride\', \'\', \'\', \'12370 S.W. First Street\', \'\', \'\', \'Beaverton\', \'OR\', \'97005\', \'\', \'(503) 644-3614\', \'\', \'\', \'\', \'\', \'\', \'2s7n60r\', \'N\', \'N\', \'N\', \'N\', \'N\', \'N\', \'N\', \'N\', \'\', \'\', \'\', \'0\', \'0000-00-00 00:00:00\', \'0000-00-00 00:00:00\', \'0\');

Share this post


Link to post
Share on other sites

This is waht I got

 

LOAD DATA INFILE \'C:\\Documents and Settings\\shiva\\Desktop\\1.txt\' INTO TABLE marketing FIELDS TERMINATED BY \',\' LINES TERMINATED BY \'n\';

 

Check the data you have.........

 

Error Code : 1062

Duplicate entry \'\' for key 3

(0 ms taken)

Share this post


Link to post
Share on other sites

I think it is the keys that are messing me up. I deleted them, was able to upload the data. Now I will work on rebuilding the keys.

 

Thanks for help.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.