Jump to content

Recommended Posts

I have a file with a little over one million rows and would like to put it in a mysql database. But I am not sure of the best and easyist way.

 

MY Table:

 

create table dbo.PUBACC_EN

(

record_type char(2) not null,

unique_system_identifier numeric(9,0) not null,

uls_file_number char(14) null,

ebf_number varchar(30) null,

call_sign char(10) null,

entity_type char(2) null,

licensee_id char(9) null,

entity_name varchar(200) null,

first_name varchar(20) null,

mi char(1) null,

last_name varchar(20) null,

suffix char(3) null,

phone char(10) null,

fax char(10) null,

email varchar(50) null,

street_address varchar(60) null,

city varchar(20) null,

state char(2) null,

zip_code char(9) null,

po_box varchar(20) null,

attention_line varchar(35) null,

sgin char(3) null,

frn char(10) null,

applicant_type_code char(1) null,

applicant_type_other char(40) null,

status_code char(1) null,

status_date datetime null

 

I attached a file with sample data.

data.txt

I think a good way to put it in mySQL is by exploding each line and getting it's element inserted in the database one by one. So you're going to read each line and explode it, then insert it to the database then move to the next line.

 

Another way is to parse it and put all in object array and then insert it in the database.

By the looks of it, you should read up on database normalization as well. So that you can make your database design into a logical model, and thus leverage the true capabilities of the DB engine. Not to mention all of the headaches it'll save you in the long run.

 

I recommend watching this series of movies, as they'll give you a fairly good introduction into the subject.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.