Re: Importing data from excel sheet

2007-04-07 Thread Andrew Dashin

Hi, sam

You can try to export table to file from Excel in CSV format.
And then import data from this file to mysql.
Something like this should help you:

LOAD DATA INFILE 'yourtabledata.txt' INTO TABLE yourtable FIELDS 
TERMINATED BY ',' ENCLOSED BY '' LINES TERMINATED BY '\r\n';


sam rumaizan wrote:
I have created table in mysql with 12 fields 
   
  Field1Field2 Field3  Field4 ……… Field12
   
   
  I have an excel sheet with 12 columns and 150 rows.
  My question is how can I import all of the columns from the excel sheet to my table without losing any information.  
   




 

 
-
Don't be flakey. Get Yahoo! Mail for Mobile and 
always stay connected to friends.
  


--
Andrew Dashin


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



RE: Importing data from MS Access

2005-01-11 Thread Bartis, Robert M (Bob)
Its my understanding you need InnoDB table types, but I do not know of the 
single foreign key per table. I have a DB with multiple foreign keys per table 
and its seems to work fine. 

Bob

-Original Message-
From: Paun [mailto:[EMAIL PROTECTED]
Sent: Tuesday, January 11, 2005 5:19 PM
To: mysql@lists.mysql.com
Subject: Importing data from MS Access




I use MySQL-Front 2.5 (freeware) for importing data from MSAccess databaase
in MySQL 4.1.7.

Of course, there is no possibility to import foreign keys from MSAccess.

Question: If I read properly documentation in MYSql is possible to use only
one foreing key per table, and fields with foreign key must be on ordered
on the same way in booth tables, and only in InnoDB type of tables.




I have tables with many foreign key connectons (e.g. members / streets,
members/occupations, members/state of membership) between tables, and it was
easier way to keep data in database in proper order with less programing. Is
that is not possible in MYSQL?

Of course, I am very new in MYSQL.

Thanks.
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.296 / Virus Database: 265.6.9 - Release Date: 1/6/2005


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: Importing data from MS Access

2005-01-11 Thread Peter Brawley
Using a data modelling tool (like Dezign from Datanamic) or a scripting 
tool (like DbScripter), all you need do, I think, is load the Access 
database into the tool, configure the tool to create an export script 
for MySQL (say, using InnoDB to enable FKs), touch up as desired, and 
generate the script.

PB
Paun wrote:
I use MySQL-Front 2.5 (freeware) for importing data from MSAccess databaase
in MySQL 4.1.7.
Of course, there is no possibility to import foreign keys from MSAccess.
Question: If I read properly documentation in MYSql is possible to use only
one foreing key per table, and fields with foreign key must be on ordered
on the same way in booth tables, and only in InnoDB type of tables.

I have tables with many foreign key connectons (e.g. members / streets,
members/occupations, members/state of membership) between tables, and it was
easier way to keep data in database in proper order with less programing. Is
that is not possible in MYSQL?
Of course, I am very new in MYSQL.
Thanks.
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.296 / Virus Database: 265.6.9 - Release Date: 1/6/2005
 


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


Re: Importing data from MS Access

2005-01-11 Thread Karam Chand
I found SQLyog Enterprise (www.webyog.com) to be the
best when importing data from ODBC to MySQL.

Karam
--- Peter Brawley [EMAIL PROTECTED] wrote:

 Using a data modelling tool (like Dezign from
 Datanamic) or a scripting 
 tool (like DbScripter), all you need do, I think, is
 load the Access 
 database into the tool, configure the tool to create
 an export script 
 for MySQL (say, using InnoDB to enable FKs), touch
 up as desired, and 
 generate the script.
 
 PB
 
 Paun wrote:
 
 I use MySQL-Front 2.5 (freeware) for importing data
 from MSAccess databaase
 in MySQL 4.1.7.
 
 Of course, there is no possibility to import
 foreign keys from MSAccess.
 
 Question: If I read properly documentation in MYSql
 is possible to use only
 one foreing key per table, and fields with
 foreign key must be on ordered
 on the same way in booth tables, and only in InnoDB
 type of tables.
 
 
 
 
 I have tables with many foreign key connectons
 (e.g. members / streets,
 members/occupations, members/state of membership)
 between tables, and it was
 easier way to keep data in database in proper order
 with less programing. Is
 that is not possible in MYSQL?
 
 Of course, I am very new in MYSQL.
 
 Thanks.
 --
 No virus found in this outgoing message.
 Checked by AVG Anti-Virus.
 Version: 7.0.296 / Virus Database: 265.6.9 -
 Release Date: 1/6/2005
 
 
   
 
 
 
 -- 
 MySQL General Mailing List
 For list archives: http://lists.mysql.com/mysql
 To unsubscribe:   

http://lists.mysql.com/[EMAIL PROTECTED]
 
 




__ 
Do you Yahoo!? 
Meet the all-new My Yahoo! - Try it today! 
http://my.yahoo.com 
 


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: importing data

2004-12-28 Thread Kai Ruhnau
Hi,
An SQL-statement that is conceptually equal to the following caused some 
astonishment.

UPDATE table1
LEFT JOIN table2 ON table2.ID=table2.ID_table1
SET table2.value=table2.value-IF(table1.condition=7,1,0),
   table1.condition=8
WHERE table1.ID=$id
My problem is the IF condition, which alway evaluates to false no matter 
what conditions value was before the query. My explanation is, that 
MySQL first updates table1 and uses the changed values to update table2.

In the meantime I solved it on application-level, but up to now I 
consindered a multi table update an atomic operation.

Is this behavior correct?
Greetings
Kai
--
This signature is left as an exercise for the reader.
Unsatz des Jahres:
$POLITIKER ruft $PARTEI zur Geschlossenheit.
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


Re: importing data

2004-12-28 Thread Curtis Maurand
I didn't, but I'll give it a shot and see what happens.
Curtis
Michael J. Pawlowsky wrote:
Curtis Maurand wrote:
If I create one of the databases and then put the files for that 
database from the old installation in place of the newly created 
ones, the database is recognized, but i get errors saying that the 
columns in the tables are not recognized.
I'd really like to get this data back is there a way?

Did you try simply repairing the table?
http://dev.mysql.com/doc/mysql/en/REPAIR_TABLE.html




--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


Re: importing data

2004-12-28 Thread Curtis Maurand
OK, now I really feel stupid.  It helps to change the ownership of the 
files to mysql:mysqlduh.

Curtis
Curtis Maurand wrote:
I didn't, but I'll give it a shot and see what happens.
Curtis
Michael J. Pawlowsky wrote:
Curtis Maurand wrote:
If I create one of the databases and then put the files for that 
database from the old installation in place of the newly created 
ones, the database is recognized, but i get errors saying that the 
columns in the tables are not recognized.
I'd really like to get this data back is there a way?


Did you try simply repairing the table?
http://dev.mysql.com/doc/mysql/en/REPAIR_TABLE.html






--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


Re: importing data

2004-12-28 Thread SGreen
One reason may be due to your ON condition. 

ON table2.ID=table2.ID_table1

You reference table 2 twice and I doubt that on the table2 table id equals 
id_table1 very often. Because table2 is LEFT JOINed to table1, you will 
only be able to update the rows that match your ON condition. Again, that 
would mean that you have nothing to update which would cause no changes to 
table2 so it would appear that the IF() is always false.

You can LEFT JOIN only those records you want to change. That way you can 
avoid the IF() and not worry about updating any other records.

I think it should look something like this:

UPDATE table1
LEFT JOIN table2 
ON table1.ID=table2.ID_table1
AND table1.condition=7
SET table2.value=table2.value-1,
table1.condition=8
WHERE table1.ID=$id

Shawn Green
Database Administrator
Unimin Corporation - Spruce Pine

Kai Ruhnau [EMAIL PROTECTED] wrote on 12/28/2004 04:22:34 
AM:

 Hi,
 
 An SQL-statement that is conceptually equal to the following caused some 

 astonishment.
 
 UPDATE table1
 LEFT JOIN table2 ON table2.ID=table2.ID_table1
 SET table2.value=table2.value-IF(table1.condition=7,1,0),
 table1.condition=8
 WHERE table1.ID=$id
 
 My problem is the IF condition, which alway evaluates to false no matter 

 what conditions value was before the query. My explanation is, that 
 MySQL first updates table1 and uses the changed values to update table2.
 
 In the meantime I solved it on application-level, but up to now I 
 consindered a multi table update an atomic operation.
 
 Is this behavior correct?
 
 Greetings
 Kai
 
 -- 
 This signature is left as an exercise for the reader.
 Unsatz des Jahres:
 $POLITIKER ruft $PARTEI zur Geschlossenheit.
 
 
 -- 
 MySQL General Mailing List
 For list archives: http://lists.mysql.com/mysql
 To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
 


Re: importing data

2004-12-27 Thread Michael J. Pawlowsky
Curtis Maurand wrote:
If I create one of the databases and then put the files for that 
database from the old installation in place of the newly created ones, 
the database is recognized, but i get errors saying that the columns in 
the tables are not recognized.
I'd really like to get this data back is there a way?

Did you try simply repairing the table?
http://dev.mysql.com/doc/mysql/en/REPAIR_TABLE.html


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


RE: Importing data from a file

2004-10-25 Thread Brian Abbott
There's a tool called mysqlimport. I recommend using that. Or, if you
have to extract data from a larger set, you could write a program. But,
mysqlimport is the easiest way. If you're on a UNIX machine, run 'man
mysqlimport' for more information.

Good luck,

Brian 

-Original Message-
From: Manuel J. Contreras Maya [mailto:[EMAIL PROTECTED] 
Sent: Monday, October 25, 2004 10:00 AM
To: [EMAIL PROTECTED]
Subject: Importing data from a file

Hello,

I am new in mysql and I woul like to ask what is the best way to import 
data from a file.

Cheers,

Manuel

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:
http://lists.mysql.com/[EMAIL PROTECTED]


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: Importing data from a file

2004-10-25 Thread Manuel J. Contreras Maya
I managed to do it using
mysql load data infile '/home/manuel/databases/import.txt'
   - into table countries
   - fields terminated by ';';
Query OK, 240 rows affected (0.01 sec)
Records: 240  Deleted: 0  Skipped: 0  Warnings: 18
(I will check the warnings...)
I guess my system do not have mysqlimport,
[EMAIL PROTECTED] manuel]$ man mysqlimport
No manual entry for mysqlimport
Thanks a lot!
Manuel


Brian Abbott wrote:
There's a tool called mysqlimport. I recommend using that. Or, if you
have to extract data from a larger set, you could write a program. But,
mysqlimport is the easiest way. If you're on a UNIX machine, run 'man
mysqlimport' for more information.
Good luck,
Brian 

-Original Message-
From: Manuel J. Contreras Maya [mailto:[EMAIL PROTECTED] 
Sent: Monday, October 25, 2004 10:00 AM
To: [EMAIL PROTECTED]
Subject: Importing data from a file

Hello,
I am new in mysql and I woul like to ask what is the best way to import 
data from a file.

Cheers,
Manuel
 


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


Re: Importing data from a file

2004-10-25 Thread Rhino
I've used the 'load data infile' command to import data from a file and it
worked well for my purposes. See
http://dev.mysql.com/doc/mysql/en/LOAD_DATA.html for the full syntax.

Rhino

- Original Message - 
From: Manuel J. Contreras Maya [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, October 25, 2004 1:59 PM
Subject: Importing data from a file


 Hello,

 I am new in mysql and I woul like to ask what is the best way to import
 data from a file.

 Cheers,

 Manuel

 -- 
 MySQL General Mailing List
 For list archives: http://lists.mysql.com/mysql
 To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]




-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: importing data into mysql from oracle using a text file

2004-09-30 Thread Harald Fuchs
In article [EMAIL PROTECTED],
[EMAIL PROTECTED] writes:

 Thanks, it is working for the mentioned format.
 
 Is there any method for importing directly the spooled file from oracle without 
 changing the file format into the required format like using tab and newline. 

I don't know Oracle, but maybe two named pipes might work:

mkfifo pipe1
mkfifo pipe2
oracleexport pipe1 
mysql db -e load data infile 'pipe2' 
sed -e whatever pipe1 pipe2


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: importing data into mysql from oracle using a text file

2004-09-29 Thread Andrey Hristov
Can you post one or 2 sample lines from alarm.txt ?
Regards,
Andrey
P.S.
(i am not on [EMAIL PROTECTED] so add me to the CC:)
[EMAIL PROTECTED] wrote:
Hi,
	   I tried with the spool option to get the data from the tables in the oracle.
	For this go to pl/sql editor, go to file menu, select spool, asks for a file name give the file name you want, later type the select command from which you want the data. and select spool of option from the file menu.
	eg; select * from alarm;
	After spooling i got the file alarm.LST as the attached (it will be there in C:/orant/bin). Save that file as .txt file.
	 
	 
	Now go to mysql prompt as a root user. 
	1) choose any of the default database by using the command 
	   eg: use test
	2) create the table alarm using the same columns, data types (here data types may differ) as in oracle
	eg; 
	  mysql CREATE TABLE ALARM (
	-ARRIVED  DATE NULL,
	-DETECTED DATE NULL,
	-NAME VARCHAR(20) NULL,
	-TYPE INTEGER(1) NULL,
	-ALARMLEVEL   INTEGER(1) NULL,
	-VERIFIED INTEGER(1) NULL,
	-DISCLOSEDINTEGER(1) NULL,
	-CATEGORY_NUM INTEGER(1) NULL,
	-EVENTID  INTEGER(5) NOT NULL,
	-REASON   VARCHAR(60) NULL
	- );
	 
	 3) Use the LOAD DAT INFILE command for data to import from .txt file (copy the alarm.txt file into c:\mysql\data\test (if we use test database))
	 
	 eg;  mysql LOAD DATA INFILE 'alarm.txt' INTO TABLE alarm;
	 
	Here the data is not inserting properly:  Bcs
	1) The data in the alarm.txt file should be like  each colum data should be seperated by \t  and each row should be separated by \n . and from spool the data is not coming in the desired format. I did not find any suitable command/option to get the spooling file with the desired delimiters. Colud any one suggest me here.
	2) The date format is different in oracle and mysql. This also i took care externally.
	3) Even i tried by formating the data in the required (see the attached alarm.txt for the format), getting the result as the following . Not inserting the data properly.
	 
	mysql LOAD DATA INFILE 'alarm.txt' INTO TABLE alarm;
	Query OK, 1 row affected (0.00 sec)
	Records: 1  Deleted: 0  Skipped: 0  Warnings: 1
	mysql select * from alarm;
	++++--++--+---+--+-+---
	-+
	| ARRIVED| DETECTED   | NAME   | TYPE | ALARMLEVEL | VERIFIED | DISCLOSED | CATEGORY_NUM | EVENTID | REASON
	 |
	++++--++--+---+--+-+---
	-+
	| 2004-09-27 | -00-00 | 2004-09-27 |0 |  0 |0 | 0 |0 |   0 |
	   |
	++++--++--+---+--+-+---
	-+
	1 row in set (0.00 sec)
	mysql
	 
	I tried with another command mysqlimport. but that command also seems to be work with the above format only. 
	Please give me a solution for this. Is there any other way to do this from oracle. My aim is dumping the data from oracle to mysql.
	 
	Thanks,
	Narasimha
	   
	 
	 
	 
	 

		-Original Message- 
		From: Praneesh Prakashan (WT01 - TELECOM SOLUTIONS) 
		Sent: Tue 9/28/2004 9:48 AM 
		To: Lakshmi NarasimhaRao (WT01 - TELECOM SOLUTIONS); Jathish Maruthoormana Jayanthan (WT01 - TELECOM SOLUTIONS) 
		Cc: Deepak Nagarajan (WT01 - TELECOM SOLUTIONS) 
		Subject: RE: Using XML with my Sql
		
		
		Hi Narasim,
		 
		In the Pro* C files (dbids.pc, dbtutil.pc), synonyms are being used.
		 
		regards,
		- Praneesh
		 

			-Original Message-
			From: Lakshmi NarasimhaRao (WT01 - TELECOM SOLUTIONS) 
			Sent: Monday, September 27, 2004 10:07 PM
			To: Jathish Maruthoormana Jayanthan (WT01 - TELECOM SOLUTIONS)
			Cc: Praneesh Prakashan (WT01 - TELECOM SOLUTIONS); Deepak Nagarajan (WT01 - TELECOM SOLUTIONS)
			Subject: RE: Using XML with my Sql
			
			
			Hi,
			  As per our discussion,  You can create an alias or synonym for a MyISAM table by defining a MERGE table that maps to that single table.  Synonym is an alias for any table, view or other object in database. 
			 
			 May i know where in the code they used synonyms?. Attached i sthe document for merging tables.
			 
			Thanks,
			Narasimha

-Original Message- 
From: Jathish Maruthoormana Jayanthan (WT01 - TELECOM SOLUTIONS) 
Sent: Fri 9/24/2004 7:44 PM 
To: Lakshmi NarasimhaRao (WT01 - TELECOM SOLUTIONS) 
Cc: 
Subject: FW: Using XML with my Sql



XML Support for MySQL support 
-Original Message- 
From: Bishnu Prasad Panda (WT01 - TELECOM SOLUTIONS) 
Sent: Thursday, September 16, 2004 6:32 PM 
To: Deepak Nagarajan (WT01 - TELECOM SOLUTIONS); Jathish 

RE: importing data into mysql from oracle using a text file

2004-09-29 Thread lakshmi.narasimharao
Title: Re: importing data into mysql from oracle using a text file






The sample lines are like this in 
alarm.txt

  
  ARRIVED DETECTED 
  NAME 
  TYPE ALARMLEVEL V DISCLOSED CATEGORY_NUM 
  EVENTID - 
  -  - -- - -  
  
  - 
  REASON 
  
   
   
  
   
  27-SEP-04 27-SEP-04 
  alaram 
  0 0 
  N 
  0 
  2 
   
  1 
  
   
  
   
  27-SEP-04 27-SEP-04 
  MiTel 
  0 0 
  N 
  0 
  2 
   2 
  
  
  The above lines i am not able to insert into mysql. 
  
  
  After changing the format as below(as in the 
  sample.txt)i am able to insert into mysql but not correclty. Couls you 
  please help me in this.
  
  
  2004-09-27\t2004-09-27\talaram\t0\t0\tN\t0\t2\t1\n
  
  thanks,
  narasimha
  
  
  
  


Confidentiality Notice The information contained in this electronic message and any attachments to this message are intendedfor the exclusive use of the addressee(s) and may contain confidential or privileged information. Ifyou are not the intended recipient, please notify the sender at Wipro or [EMAIL PROTECTED] immediatelyand destroy all copies of this message and any attachments.

ARRIVED   DETECTED  NAME  TYPE ALARMLEVEL V DISCLOSED CATEGORY_NUM 
  EVENTID
- -  - -- - -  
-
REASON 
 
   
 
27-SEP-04 27-SEP-04 alaram   0  0 N 02 
1
   
 
   
 
27-SEP-04 27-SEP-04 MiTel0  0 N 02 
2
   
 
   
 
 2004-09-27  \t  2004-09-27  \t  alaram  \t  0   \t  0  
 \t  N   \t  0   \t  2   \t  1   \n-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]

Re: importing data into mysql from oracle using a text file

2004-09-29 Thread Andrey Hristov
 Hi,
I did imported your data im my server but I had to do some changes to sample.txt.
I have replaced in a text editor tab\t with empty string. tab is a real tab
while \t is just a text. Additional change was to replace \n (which is text but not
newline with empty string). The I did the following (before that I have created the
table) :
mysql load data local infile /home/andrey/Desktop/sample2.txt into table ALARM FIELDS 
ESCAPED BY '\\';
Query OK, 1 row affected, 1 warning (0.03 sec)
Records: 1  Deleted: 0  Skipped: 0  Warnings: 1

mysql show warnings;
+-+--++
| Level   | Code | Message|
+-+--++
| Warning | 1261 | Row 1 doesn't contain data for all columns |
+-+--++
1 row in set (0.00 sec)
mysql select * FROM ALARM;
++++--++--+---+--+-++
| ARRIVED| DETECTED   | NAME   | TYPE | ALARMLEVEL | VERIFIED | DISCLOSED | 
CATEGORY_NUM | EVENTID | REASON |
++++--++--+---+--+-++
| 2004-09-27 | 2004-09-27 | alaram |0 |  0 | NULL | 0 | 
 2 |   1 | NULL   |
++++--++--+---+--+-++
1 row in set (0.02 sec)

You can see the warning since the number of fields was less the needed. Or maybe you 
wanted by having \n to express NULL? Last thing to do over sample.text is to mark all
places where NULL should appear with \N .

Hope this helps,
Andrey
[EMAIL PROTECTED] wrote:
Tha sample lines are like this in alarm.txt
 
ARRIVED   DETECTED  NAME  TYPE ALARMLEVEL V DISCLOSED CATEGORY_NUM   
EVENTID
- -  - -- - -  
-
REASON   
   
 
   
27-SEP-04 27-SEP-04 alaram   0  0 N 02   
  1
 
   
 
   
27-SEP-04 27-SEP-04 MiTel0  0 N 02   
  2
 
 
The above lines i am not able to insert into mysql. 
 
After changing the format as below(as in the sample.txt) i am able to insert into mysql but not correclty. Couls you please help me in  this.
 
 
2004-09-27 \t 2004-09-27 \t alaram \t 0 \t 0 \t N \t 0 \t 2 \t 1 \n
 
thanks,
narasimha
 
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


RE: importing data into mysql from oracle using a text file

2004-09-29 Thread lakshmi.narasimharao

Thanks, it is working for the mentioned format.
 
Is there any method for importing directly the spooled file from oracle without 
changing the file format into the required format like using tab and newline. 
 
thanks,
narasimha

-Original Message- 
From: Andrey Hristov [mailto:[EMAIL PROTECTED] 
Sent: Thu 9/30/2004 2:01 AM 
To: Lakshmi NarasimhaRao (WT01 - TELECOM SOLUTIONS) 
Cc: [EMAIL PROTECTED] 
Subject: Re: importing data into mysql from oracle using a text file



  Hi,
I did imported your data im my server but I had to do some changes to 
sample.txt.
I have replaced in a text editor tab\t with empty string. tab is a real 
tab
while \t is just a text. Additional change was to replace \n (which is text 
but not
newline with empty string). The I did the following (before that I have 
created the
table) :

mysql load data local infile /home/andrey/Desktop/sample2.txt into table 
ALARM FIELDS
ESCAPED BY '\\';
Query OK, 1 row affected, 1 warning (0.03 sec)
Records: 1  Deleted: 0  Skipped: 0  Warnings: 1

mysql show warnings;
+-+--++
| Level   | Code | Message|
+-+--++
| Warning | 1261 | Row 1 doesn't contain data for all columns |
+-+--++
1 row in set (0.00 sec)

mysql select * FROM ALARM;

++++--++--+---+--+-++
| ARRIVED| DETECTED   | NAME   | TYPE | ALARMLEVEL | VERIFIED | DISCLOSED |
CATEGORY_NUM | EVENTID | REASON |

++++--++--+---+--+-++
| 2004-09-27 | 2004-09-27 | alaram |0 |  0 | NULL | 0 |
  2 |   1 | NULL   |

++++--++--+---+--+-++
1 row in set (0.02 sec)


You can see the warning since the number of fields was less the needed. Or 
maybe you
wanted by having \n to express NULL? Last thing to do over sample.text is to 
mark all
places where NULL should appear with \N .

Hope this helps,
Andrey


[EMAIL PROTECTED] wrote:
 Tha sample lines are like this in alarm.txt
 
 ARRIVED   DETECTED  NAME  TYPE ALARMLEVEL V DISCLOSED 
CATEGORY_NUM  
 EVENTID   
 - -  - -- - - 

 -   
 REASON   
   
   
  
   
   
 27-SEP-04 27-SEP-04 alaram   0  0 N 0
2  
   1   
  
   
   
  
   
   
 27-SEP-04 27-SEP-04 MiTel0  0 N 0
2  
   2   
 
 
 The above lines i am not able to insert into mysql.
 
 After changing the format as below(as in the sample.txt) i am able to insert 
into mysql but not correclty. Couls you please help me in  this.
 
 
 2004-09-27 \t 2004-09-27 \t alaram \t 0 \t 0 \t N \t 0 \t 2 \t 1 \n
 
 thanks,
 narasimha
 




Confidentiality Notice 

The information contained in this electronic message and any attachments to this 
message are intended
for the exclusive use of the addressee(s) and may contain confidential or privileged 
information. If
you are not the intended recipient, please notify the sender at Wipro or [EMAIL 
PROTECTED] immediately
and destroy all copies of this message and any attachments.


Re: Importing data, indexes, and analyzing tables.

2004-06-17 Thread David Griffiths
After a day of looking, I answered my own questions, and I'll post those 
answers here in case anyone else was interested in the answer.

First, LOAD DATA + ALTER TABLE ADD INDEX... seems to be slower than 
a mysqldump + ANALYZE TABLE. Of course, you don't always have a 
mysql dump file.

After importing a mysql dump file, it's wise to analyze all tables 
imported. I found that SHOW INDEX FROM table; would show the cardinality 
(the number of unique values) of an index. The more unique the data 
being indexed, the faster the index is. Another way to put it, if you 
set up an equation like,

(# of rows in table) divided by (cardinality of an index)
you would want a number that is as close to 1 as possible (there will 
never be more unique values in a table than there are rows). The lower 
that ratio is (the closer to 1), the more efficient the index becomes.

Here's an example of the cardinality after a dump but before an ANALYZE 
TABLE, and after an ANALYZE TABLE (these two indexes are on the same 
table) from our database; there are 502055 rows in this table. Index 
names have been changed to protect the innocent:

Before the ANALYZE,
index1 has a cardinality of 81214
index2 has a cardinality of 81214
After the ANALYZE
index1 has a cardinality of 97192
index2 has a cardinality of 20248
If no analyze was done, and someone did an equi-join on the column 
indexed by index1 and a second join on the column indexed by index2, the 
optimizer would use some other criteria for selecting an index other 
than the cardinality (perhaps the data-type of the column, the 
alphabetical order of the column, etc - anyone know what that criteria 
would be?).

After the analyze, you can see that the cardinality of index1 has gone 
up, while index2 has gone down. Index1 is now a far better choice for 
the optimizer to use (remember, MySQL can only use one index per table 
per query, so it has to pick the most efficient one), and should result 
in faster results.

Hope that provides some insight for anyone interested.
David.

David Griffiths wrote:
We have a somewhat large database, with a snapshot of the data that we 
import into the database. Normally, we create a database, create the 
tables, import the data with LOAD DATA, add the indexes, and then 
the foreign keys (we are using InnoDB, 4.0.18). We call this the 
load-data-method.

Sometimes we dump the data with mysqldump, create a new database, and 
pipe the dump file into the new database. We call this the 
mysqldump-method.

I was wondering about the time it takes to import either one. The 
mysqldump-method takes about 45 minutes. Tables, indexes and foreign 
keys are created. The load-data-method takes two to three hours.

Using LOAD DATA is supposed to be the fastest way to get data into 
MySQL. We use the ALTER TABLE ADD INDEX (), ADD INDEX() ... method, 
which is supposed to be the fastest way to add indexes to a table.

So I'm curious as to why it takes so much longer. I suspect that the 
mysqldump-method needs an ANALYZE TABLE ... (for each table in the 
database) at the end of it, to rebuild the statistics for the tables, 
and if that was done, then the load-data-method would be comparitively 
faster. Is this correct, or am I off-base with this? Are the 
statistics for the indexes in InnoDB correct or incorrect after a 
mysqldump file is imported into the db.

This brings my next question - as I was looking around, trying to get 
some insight, I was reading the mysql documentation on SHOW INDEX 
FROM tablename, which is supposed to show key-distribution across a 
table (http://dev.mysql.com/doc/mysql/en/ANALYZE_TABLE.html).

I've run it, and I'm a bit confused about inferring anything from the 
results of the SHOW INDEX... statement 
(http://dev.mysql.com/doc/mysql/en/SHOW_INDEX.html). The most 
interesting column in the result set seems to be the cardinality 
column, which stores the number of unique values in an index, but on 
large tables, it's tough to know if that's accurate if the index is 
not unique. Is there any way to read the results of a SHOW INDEX to be 
able to figure out if a table needs analyzing?

MySQL (Paul DuBois) was written before ANALYZE TABLE was relevant for 
InnoDB, and High Performance MySQL (Jeremy Zawodny and Derek Balling) 
doesn't delve into the details about the circumstances where tables 
(and indexes) need to be re-analyzed.

Thanks in advance for any replies.
David.




--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


Re: importing data

2004-06-04 Thread Ben Clewett
This is just my experience.
But if you are doing this sort of work, it may well pay to construct 
your own import program.  There are many ways of doing this, like 
parsing an email message, or using a XML/SOAP server.  This will 
probably pay on the long run, as you can introduce filters, data checks, 
security and pre-processing.

Ben.
Paul Kruger wrote:
Hello..
Im a new sql user so if this is a common prob 
Please be kind
 
Im trying to set up mysql 4.0.13
With a database that contains 60k records
The client wants to import 6 records a week
With near 4mill records in a database
My problem is I dont want to give ssh access to
The machine
 
So iv tried phpmyadmin
And access to import the data but it seems to get to 40k records
And then fails or times out
 
What methods do you all use to import super large amounts of data?
 
Thanks in advance
Paul

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.690 / Virus Database: 451 - Release Date: 5/22/2004
 


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


Re: Importing Data into MySQL

2003-12-19 Thread Michael Stassen
If I understand correctly, your text file does not have an ID for each 
row, but the table does have an ID column.  Good.   Your table should 
have the record ID column defined as AUTO_INCREMENT.  Something like

CREATE TABLE table_name (
  ID int NOT NULL PRIMARY KEY AUTO_INCREMENT,
  other column definitions...
In that case, simply leave ID out of the columns you are importing to 
have mysql automatically fill in the ID with unique values.  That's the 
point of AUTO_INCREMENT.  The AUTO_INCREMENT column gets a unique number 
assigned by mysql if you leave it out or if you assign it the (non) 
value NULL.

See

Using AUTO_INCREMENT
  http://www.mysql.com/doc/en/example-AUTO_INCREMENT.html and
CREATE TABLE Syntax,
  http://www.mysql.com/doc/en/CREATE_TABLE.html
and mysqlimport, Importing Data from Text Files
  http://www.mysql.com/doc/en/mysqlimport.html
in the manual for more.

Michael

Bob Cohen wrote:

Sorry in advance for the dumb newbie question but . . . I'm using a
content management system and want to avoid the hassle of entering data
by hand when I've already got it in a delimited text file.  I get the
basic concept of using mysqlimport.  However, the source file's data
doesn't match the target file's structure.  Of particular concern for me
is that the target table has record id files the would need to be
incremented.
I get the task on the conceptual level.  E.g., map the incoming columns
with the appropriate fields in the target table and increment the record
id number.  I'm a web designer not a programmer. I'm not at all sure how
to accomplish this task. Though I would like to learn.
Any help would be appreciated.  Thanks.

Bob Cohen
b.p.e.Creative
http://www.bpecreative.com
Design and production services for the web
Put creative minds to work for you



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


RE: Importing data

2003-12-05 Thread Jay Blanchard
[snip]
How can i import table structure and data which is there in a text file
to database say test_database using phpmyadmin. I m asking using
phpMyadmin as i don have shell access and hence can't use mysql
commands.
[/snip]

What format is the table structure in?

As for the data it should be fairly straighht forward. Even as text it
should be delimited (either by comma, tab, or other similar delimeter). 

Once the tables are created you can import in phpmyadmin by viewing the
table properties page and clicking the 'Insert data from a textfile into
table' link and following the directions. 

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: Importing Data

2003-10-30 Thread Roger Baklund
* Trevor
 after a bit of help on how to import data from a pastel
 accounting database into mysql, i also need to remove some lines
 out of the pastel txt file before importing into mysql

You are defining your new problem to be something to be sorted out before
mysql is involved, in which case this list is the wrong forum. You would use
a programming language or text stream editor tool, or maybe even a text
editor, if the amount of data is small. Which of those you would choose
depends on your OS and your previous knowledge.

However, your problem can probably also be solved within mysql.

 eg 1
 *PC\CC-ABS533  ,COMPUCON Abacus Celeron/Pentium PC
 ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,,

 has to end up with this data
 *PC\CC-ABS533  ,COMPUCON Abacus Celeron/Pentium PC  ,0

 eg2
 NCHW\IQISW050R ,iNEQ Wireless BB Rou. USB PrnServer
 ,218,217,0,0,239.8,238.7,0,0,0,0,0,0,0,0,,

 has to end up with this data
 NCHW\IQISW050R ,iNEQ Wireless BB Rou. USB PrnServer,218

Looks like you wish to drop many of the columns? You can do that after the
import, using the ALTER TABLE statement, or you can avoid importing them in
the first place, using a field list in the LOAD DATA statement.

URL: http://www.mysql.com/doc/en/ALTER_TABLE.html 
URL: http://www.mysql.com/doc/en/LOAD_DATA.html 

 in the same file it has line as follows, they have a common
 factor zz, these lines need to be deleted
 ZVPX\ARDX550   ,zz BenQ DX550 1200 Lum. XGA DLP AV-Box

You can delete rows after the data is imported, using a DELETE statement.

If the column was named ProdName and the table was named Products:

DELETE FROM Products WHERE ProdName LIKE zz%;

URL: http://www.mysql.com/doc/en/DELETE.html 

--
Roger


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: importing data

2003-05-30 Thread Rajendra Kumar
Hello Sir,

  thanks for the reply. i have one more doubt.

 i want to import 2 tables from one database to
another database like the tables structure and as well
as its records.

have a nice day,

Naren.



 --- Egor Egorov [EMAIL PROTECTED] wrote: 
Rajendra Kumar [EMAIL PROTECTED] wrote:
  
   i know little bit about mysql. i use mysql to use
  the webportal system of phpnuke.  can anyone help
 me
  to import data in mysql. for exams i have a file
  nuke.sql which contains like tables design and
 there
  records.
  
   how to call this file when i am having sql
 prompt. i
  use redhat linux for mysql.
  
  
 
 Execute from the shell:
 
   mysql -uuser_name -p database_name  nuke.sql
 
 and enter the user password. 
 
 
 
 -- 
 For technical support contracts, goto
 https://order.mysql.com/?ref=ensita
 This email is sponsored by Ensita.net
 http://www.ensita.net/
__  ___ ___   __
   /  |/  /_ __/ __/ __ \/ /Egor Egorov
  / /|_/ / // /\ \/ /_/ / /__  
 [EMAIL PROTECTED]
 /_/  /_/\_, /___/\___\_\___/   MySQL AB / Ensita.net
___/   www.mysql.com
 
 
 
 
 -- 
 MySQL General Mailing List
 For list archives: http://lists.mysql.com/mysql
 To unsubscribe:   
 http://lists.mysql.com/[EMAIL PROTECTED]
  


Missed your favourite TV serial last night? Try the new, Yahoo! TV.
   visit http://in.tv.yahoo.com

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: importing data

2003-05-30 Thread Nils Valentin
Sorry hit the wrong reply button ;-)
 Hi Rajendra,

 In case you are new to mysql the easiest way would be to do it on the
 command line base :

 1) shutdown the server
 2) go to your data directory f.e /var/lib/mysql/dbname1
 3) copy the table files to the folder of dbname2

   f.e cp -r * ../dbname2

 4) change the ownership of the copied tables in ../dbname2 to the Linux
 mysql account

 chown -r username tablename
 chgrp -r usergrp tablename

 5) start your mysql server again

 Thats not the most professional way , put for beginners the easiest way to
 do it.



 Best regards

 Nils Valentin
 Tokyo/Japan

 2003 5 30  11:24Rajendra Kumar :
  Hello Sir,
 
thanks for the reply. i have one more doubt.
 
   i want to import 2 tables from one database to
  another database like the tables structure and as well
  as its records.
 
  have a nice day,
 
  Naren.
 
 
 
   --- Egor Egorov [EMAIL PROTECTED] wrote: 
 
  Rajendra Kumar [EMAIL PROTECTED] wrote:
 i know little bit about mysql. i use mysql to use
the webportal system of phpnuke.  can anyone help
  
   me
  
to import data in mysql. for exams i have a file
nuke.sql which contains like tables design and
  
   there
  
records.
   
 how to call this file when i am having sql
  
   prompt. i
  
use redhat linux for mysql.
  
   Execute from the shell:
  
 mysql -uuser_name -p database_name  nuke.sql
  
   and enter the user password.
  
  
  
   --
   For technical support contracts, goto
   https://order.mysql.com/?ref=ensita
   This email is sponsored by Ensita.net
   http://www.ensita.net/
  __  ___ ___   __
 /  |/  /_ __/ __/ __ \/ /Egor Egorov
/ /|_/ / // /\ \/ /_/ / /__
   [EMAIL PROTECTED]
   /_/  /_/\_, /___/\___\_\___/   MySQL AB / Ensita.net
  ___/   www.mysql.com
  
  
  
  
   --
   MySQL General Mailing List
   For list archives: http://lists.mysql.com/mysql
   To unsubscribe:
   http://lists.mysql.com/[EMAIL PROTECTED]
 
  
  Missed your favourite TV serial last night? Try the new, Yahoo! TV.
 visit http://in.tv.yahoo.com

-- 

Valentin Nils
Internet Technology

 E-Mail: [EMAIL PROTECTED]
 URL: http://www.knowd.co.jp/staff/nils

 
 182-0024 4-6-1 7F
 Phone: 0424-40-7912 Fax: 0424-40-7913
 URL: http://www.knowd.co.jp



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: importing data

2003-05-29 Thread Egor Egorov
Rajendra Kumar [EMAIL PROTECTED] wrote:
 
  i know little bit about mysql. i use mysql to use
 the webportal system of phpnuke.  can anyone help me
 to import data in mysql. for exams i have a file
 nuke.sql which contains like tables design and there
 records.
 
  how to call this file when i am having sql prompt. i
 use redhat linux for mysql.
 
 

Execute from the shell:

mysql -uuser_name -p database_name  nuke.sql

and enter the user password. 



-- 
For technical support contracts, goto https://order.mysql.com/?ref=ensita
This email is sponsored by Ensita.net http://www.ensita.net/
   __  ___ ___   __
  /  |/  /_ __/ __/ __ \/ /Egor Egorov
 / /|_/ / // /\ \/ /_/ / /__   [EMAIL PROTECTED]
/_/  /_/\_, /___/\___\_\___/   MySQL AB / Ensita.net
   ___/   www.mysql.com




-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: importing data from pervasvie to MySQL

2003-03-02 Thread Maciej Bobrowski

 Hi all,

Hi,

 I have a database in Pervasive and I want to import it to MySQL.
 I tried to convert the Pervasive data to a text file and then import it
 into MySQL but it failed.
 Is there any tool to do this directly?
 Does MySQLCC provide any export option through which I can get the data
 from Pervasive?

Try Perl. You can do everything You need.

Best regards,
Maciej Bobrowski


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php



Re: importing data

2001-08-08 Thread Stefan Hinz

Dear Kevin,

check the online manual (www.mysql.com/documentation) for mysqlimport
and for load data infile.

Regards,

--
  Stefan Hinz
  Geschäftsführer / CEO iConnect e-commerce solutions GmbH
  #  www.js-webShop.com www.iConnect.de
  #  Gustav-Meyer-Allee 25, 13355 Berlin
  #  Tel: +49-30-46307-382  Fax: +49-30-46307-388

- Original Message -
From: Bing Du [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, August 07, 2001 9:03 PM
Subject: Re: importing data


 Please see section 6.17 of http://www.mysql.com/doc/index.html.

 Bing

 Bing Du [EMAIL PROTECTED], 979-845-9577
 Texas AM University, CIS, Operating Systems, Unix

  Kevin Fonner [EMAIL PROTECTED] 08/07/01 10:08AM 
 Is there an easy way or perhaps a utility to import a tab delimeted
 text
 file of data into a mysql table

 Thanks,

 --
 Kevin Fonner



 -
 Before posting, please check:
http://www.mysql.com/manual.php   (the manual)
http://lists.mysql.com/   (the list archive)

 To request this thread, e-mail [EMAIL PROTECTED]
 To unsubscribe, e-mail
 [EMAIL PROTECTED]
 Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php



 -
 Before posting, please check:
http://www.mysql.com/manual.php   (the manual)
http://lists.mysql.com/   (the list archive)

 To request this thread, e-mail [EMAIL PROTECTED]
 To unsubscribe, e-mail
[EMAIL PROTECTED]
 Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




RE: importing data

2001-08-07 Thread Carsten H. Pedersen

Look up 
IMPORT DATA INFILE
in the manual

/ Carsten
--
Carsten H. Pedersen
keeper and maintainer of the bitbybit.dk MySQL FAQ
http://www.bitbybit.dk/mysqlfaq

 -Original Message-
 From: Kevin Fonner [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, August 07, 2001 5:09 PM
 To: [EMAIL PROTECTED]
 Subject: importing data
 
 
 Is there an easy way or perhaps a utility to import a tab delimeted text 
 file of data into a mysql table
 
 Thanks,
 
 -- 
 Kevin Fonner
 
 
 
 -
 Before posting, please check:
http://www.mysql.com/manual.php   (the manual)
http://lists.mysql.com/   (the list archive)
 
 To request this thread, e-mail [EMAIL PROTECTED]
 To unsubscribe, e-mail 
 [EMAIL PROTECTED]
 Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
 

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: importing data

2001-08-07 Thread j.urban

http://www.mysql.com/doc/L/O/LOAD_DATA.html
http://www.mysql.com/doc/m/y/mysqlimport.html
http://www.mysql.com/doc/L/o/Loading_tables.html


On Tue, 7 Aug 2001, Kevin Fonner wrote:

 Is there an easy way or perhaps a utility to import a tab delimeted text 
 file of data into a mysql table
 
 Thanks,
 
 -- 
 Kevin Fonner
 
 
 
 -
 Before posting, please check:
http://www.mysql.com/manual.php   (the manual)
http://lists.mysql.com/   (the list archive)
 
 To request this thread, e-mail [EMAIL PROTECTED]
 To unsubscribe, e-mail [EMAIL PROTECTED]
 Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
 


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: importing data

2001-08-07 Thread Bing Du

Please see section 6.17 of http://www.mysql.com/doc/index.html.

Bing

Bing Du [EMAIL PROTECTED], 979-845-9577
Texas AM University, CIS, Operating Systems, Unix

 Kevin Fonner [EMAIL PROTECTED] 08/07/01 10:08AM 
Is there an easy way or perhaps a utility to import a tab delimeted
text 
file of data into a mysql table

Thanks,

-- 
Kevin Fonner



-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail
[EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php



-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: importing data

2001-08-07 Thread Stefan Hinz

Dear Kevin,

 Is there an easy way or perhaps a utility to import a tab delimeted
text
 file of data into a mysql table

Try PhpMyAdmin (www.phpmyadmin.com). Great browser based utility. You
need to have PHP installed in order to use it.

You may as well use the LOAD DATA INFILE command. Check
http://www.mysql.com/doc/L/O/LOAD_DATA.html for details.

Regards,

--
  Stefan Hinz
  Geschäftsführer / CEO iConnect e-commerce solutions GmbH
  #  www.js-webShop.com www.iConnect.de
  #  Gustav-Meyer-Allee 25, 13355 Berlin
  #  Tel: +49-30-46307-382  Fax: +49-30-46307-388

- Original Message -
From: Kevin Fonner [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, August 07, 2001 5:08 PM
Subject: importing data


 Is there an easy way or perhaps a utility to import a tab delimeted
text
 file of data into a mysql table

 Thanks,

 --
 Kevin Fonner



 -
 Before posting, please check:
http://www.mysql.com/manual.php   (the manual)
http://lists.mysql.com/   (the list archive)

 To request this thread, e-mail [EMAIL PROTECTED]
 To unsubscribe, e-mail
[EMAIL PROTECTED]
 Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php



-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: importing data from FileMaker Pro to MySQL

2001-03-26 Thread Basil Hussain

Hi,

 I have to import Datas From FileMaker Pro to MySQL .
 
 Unfortunately, the FileMaker web site is speaking about plugins to export
 databases, but the access page gives error 500 (!).

Plug-ins? You don't need any plug-ins to export data to MySQL. The only
plug-in for Filemaker I've ever heard of concerning MySQL is one that
allowed you to access MySQL data through Filemaker.

 Then, I try this mailling list, and there is my question :
 
 is there any defined tool to import datas into MySQL Databases, that may also
 read the FileMakerPro Format, or any standard CSV format ?

MySQL will import data from CSV format quite happily, with no extras
required.

 I thought about developping something myself, in Perl (quite easy to use ...),
 but there is also no Perl module avaliable for FileMaker  ...

I would be extremely surprised if there was!

I think you're getting into extremely muddy waters here. What you're trying
to do is very simple. Just open your Filemaker database, export the fields
you want to a tab-seperated text file, transfer that file to your MySQL
server (make sure you convert Mac line breaks to UNIX too) and import the
file using the LOAD DATA statement in the MySQL command-line client.

Regards,


Basil Hussain ([EMAIL PROTECTED])


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: importing data from excel

2001-02-26 Thread Thomas Spahni

On Thu, 4 Jan 2001, TEXLID_SUPPORT wrote:

 Could anyone please let me know how I can transfer data from excel to
 a mysql database? If it is possible. The data is stored in an excel
 file on my PC. And I want to transfer the contents (about 500 records
 with 20 fields)  of this excel file to a mysql table on a remote linux
 server.

Edd,

export from EXCEL to *.csv format. Then pipe it though the program below.
Depending on your data some additional quoting with sed might be needed.
Resulting TAB separated file is easily read with "load data infile". You
have to write the CREATE clause manually.

Thomas

/*
 *  csv - preprocess *.csv files
 *
 *  AUTHOR: Thomas Spahni ([EMAIL PROTECTED])
 *
 *  This program is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU General Public License
 *  as published by the Free Software Foundation; either version 2
 *  of the License, or (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 */

#include stdio.h
#include stdlib.h

/*
 * Files in *.csv format can be a pain to process with sed when they
 * contain '\n' ( newline or line-feed ) characters within quoted 
 * data fields.
 *
 * This filter will go through the file and determine if a newline is
 * part of the data or indicates the end of a record. Any newline
 * found as data is converted to '\r' or carriage-return and existing
 * carriage-returns are deleted. At the same time this is a conversion
 * from DOS to unix style.
 *
 * Functions performed:
 *  - field separating semicolons are replaced by tab
 *  - field delimiting semicolons are deleted
 *  - newlines within quoted data fields become '\r'
 *  - preexisting carriage returns are deleted
 *
 */

int main (int argc, char *argv[])
{

int c;

   /*
* quoted_data is a switch to indicate whether we are in a quoted
* data field or not. 0 = normal outside, 1 = within data field
*/
 
int quoted_data = 0;

   /*
* hanging_quote is a switch to remember if we have already 
* seen the first one of a pair of double quotes.
*/
 
int hanging_quote = 0;


while ((c = getchar()) != EOF) {
if ( c == '"' ) {
/*
 * quoted_data status does not matter if it is a quote;
 * this quote could be the beginning or the end of a
 * data field or it is the beginning of a quote ""
 */
if ( hanging_quote ) {
/* this is definitely a complete quote now */
hanging_quote = 0;
putchar(c);
} else {
hanging_quote = 1;   /* wait to see what follows */
}
} else {
/* not a quote character */
if ( quoted_data ) {
/* we are within a quoted data field */
if ( hanging_quote ) {
/* it's a single quote terminating quoted data */
quoted_data   = 0;
hanging_quote = 0;
if ( c == ';' ) {
putchar('\t');
} else if ( c != '\r' ) {
putchar(c);
}
} else {
/* within quoted data, special rules apply */
if ( c == '\n' ) {
putchar('\r');
} else if ( c != '\r' ) {
putchar(c);
}
}
} else {
if ( hanging_quote ) {
/* it's a single quote starting quoted data */
quoted_data   = 1;
hanging_quote = 0;
}
if ( c == ';' ) {
putchar('\t');
} else if ( c != '\r' ) {
putchar(c);
}
}
}
} /* wend */
fflush(stdout);
exit(EXIT_SUCCESS);
}


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php