List:General Discussion« Previous MessageNext Message »
From:axis Date:September 13 2006 1:10am
Subject:What's the best way to INSERT a long list of email addresses and
names into a TABLE?
View as plain text  
Hi,

I have a long list of email addresses, and names in a text file in csv 
format, and I want to know what's the best approach to quickly INSERT 
them into my customers TABLE.
Initially I thought it could be easy to just add SQL INSERTs to the 
database dump but, the problem is I have to manually add some fields and 
that can be a tedious and slow process, is there a better approach?

This is the table structure:

CREATE TABLE `customers` (
  `customers_id` int(11) NOT NULL auto_increment,
  `purchased_without_account` tinyint(1) unsigned NOT NULL default '0',
  `customers_gender` char(1) NOT NULL default '',
  `customers_firstname` varchar(32) NOT NULL default '',
  `customers_lastname` varchar(32) NOT NULL default '',
  `customers_dob` datetime NOT NULL default '0000-00-00 00:00:00',
  `customers_email_address` varchar(96) NOT NULL default '',
  `customers_default_address_id` int(11) default NULL,
  `customers_telephone` varchar(32) NOT NULL default '',
  `customers_fax` varchar(32) default NULL,
  `customers_password` varchar(40) NOT NULL default '',
  `customers_newsletter` char(1) default NULL,
  `customers_group_name` varchar(27) NOT NULL default 'Retail',
  `customers_group_id` int(11) NOT NULL default '0',
  PRIMARY KEY  (`customers_id`),
  KEY `purchased_without_account` (`purchased_without_account`)
) TYPE=MyISAM AUTO_INCREMENT=60 ;

I only have Name and Email in the text file.

Sincerely,

Axis

-- 


Thread
What's the best way to INSERT a long list of email addresses andnames into a TABLE?axis13 Sep
  • RE: What's the best way to INSERT a long list of email addresses and names into a TABLE?Don13 Sep
  • RE: What's the best way to INSERT a long list of email addresses and names into a TABLE?Jerry Schwartz13 Sep