473,320 Members | 2,024 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Import question

Hello,

I am using the LOAD DATA INFILE command to import a text file into
mysql.

However, there is much more text in the file than needed in my tables.
How can I make a selection from the text line. For example position 5 -
10 in field A, position 20-23 in field B, etc

Regards,

Joost.
Jul 23 '05 #1
3 2125
On Tue, 31 May 2005 10:21:47 +0200, in mailing.database.mysql "Joost"
<a@b.c> wrote:
| Hello,
|
| I am using the LOAD DATA INFILE command to import a text file into
| mysql.
|
| However, there is much more text in the file than needed in my tables.
| How can I make a selection from the text line. For example position 5 -
| 10 in field A, position 20-23 in field B, etc


Simple answer: you can't.

What you need to do is import your data into a temporary table.
Massage the data the way you want it within this table.
Update/Replace/Insert you temp data fields into your normal table.
---------------------------------------------------------------
jn******@yourpantsyahoo.com.au : Remove your pants to reply
---------------------------------------------------------------
Jul 23 '05 #2
Jeff North formuleerde de vraag :
On Tue, 31 May 2005 10:21:47 +0200, in mailing.database.mysql "Joost"
<a@b.c> wrote:
Hello,

I am using the LOAD DATA INFILE command to import a text file into
mysql.

However, there is much more text in the file than needed in my tables.
How can I make a selection from the text line. For example position 5 -
10 in field A, position 20-23 in field B, etc


Simple answer: you can't.

What you need to do is import your data into a temporary table.
Massage the data the way you want it within this table.
Update/Replace/Insert you temp data fields into your normal table.
---------------------------------------------------------------
jn******@yourpantsyahoo.com.au : Remove your pants to reply
---------------------------------------------------------------


I was afraid that someone was going to say this...

Anyway, thank you for confirming this.

Joost.

PS: I like the remove your pants part. :D Didn't see that one before...
Jul 23 '05 #3
On Tue, 31 May 2005 19:17:47 +0200, in mailing.database.mysql "Joost"
<a@b.c> wrote:
| Jeff North formuleerde de vraag :
| > On Tue, 31 May 2005 10:21:47 +0200, in mailing.database.mysql "Joost"
| > <a@b.c> wrote:
| >
| >>> Hello,
| >>>
| >>> I am using the LOAD DATA INFILE command to import a text file into
| >>> mysql.
| >>>
| >>> However, there is much more text in the file than needed in my tables.
| >>> How can I make a selection from the text line. For example position 5 -
| >>> 10 in field A, position 20-23 in field B, etc
| >
| > Simple answer: you can't.
| >
| > What you need to do is import your data into a temporary table.
| > Massage the data the way you want it within this table.
| > Update/Replace/Insert you temp data fields into your normal table.
|
| I was afraid that someone was going to say this...
|
| Anyway, thank you for confirming this.


I always use temp tables when importing data. Why?
1. Because you can bet there will be one or two records that are
incorrect and will not import into the main tables correctly.

2. if the data is corrupt then you simply clear out the temp table and
start again. Your main data isn't affected in anyway.

3. is that it is quicker to apply the 'rules' to this small data set
that manipulating the larger set.

4. data can be easily split out to as many tables as required.
---------------------------------------------------------------
jn******@yourpantsyahoo.com.au : Remove your pants to reply
---------------------------------------------------------------
Jul 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Kevin MacKenzie | last post by:
I'm a complete newbie to using Python. I have a small question about importing modules. Is there any difference between the two following statements, and what (if any) are they? >>> from...
0
by: Stian Søiland | last post by:
all examples performed with: Python 2.3+ (#2, Aug 10 2003, 11:09:33) on linux2 (2, 3, 0, 'final', 1) This is a recursive import:
1
by: Raaijmakers, Vincent \(GE Infrastructure\) | last post by:
Question: my src path looks like this: src\root\sub1 src\root\sub2 My main code is in root, lets say main.py and there is also a lib.py. In sub1 there if foo1.py and sub2 foo2.py Sorry for...
3
by: Doug Baroter | last post by:
Hi, One of my clients has the following situation. They use Access DB for data update etc. some business functions while they also want to view the Access data quickly and more efficiently in...
2
by: jet | last post by:
Hi, Maybe this is an easy task, but I'm having a really hard time figuring out how to do this. I'm a complete newbie to SQL Server. I have a database dump file from MySQL that's in .sql...
2
by: Charles Fineman | last post by:
I've been asked to look over an integration toolkit that has a bunch of schemas to specify message format. There are a couple of strange things I noticed right off the bat and I wanted to get...
1
by: Dan | last post by:
Could someone please help me with auto importing a series of data files into an Access table. I tried to follow code given below in a previous messagebut i'm getting error messages. Here's my...
4
by: Bruce W. Roeser | last post by:
All, I'm reading a book by Charles Petzold (Programming VS.Net). Pretty good content but am confused about the difference. From the text: ...
3
by: SMALLp | last post by:
Hy! I'm new in Linux, and i feel little less newer in python. I need advice and help. I'm making an application witch purpose is irrelevant. It has a lot of code for now and I've only made...
0
by: 123bargains | last post by:
Hello, I have a question on importing a database from MSSQL 2000 to MSSQL 2005. I hope someone on here can help me answer it. I am trying to import a database from MSSQL 2000 to 2005. But, when I...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.