Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    MYSQL






SuperbHosting.net & Arvixe.com have generously sponsored dedicated servers and web hosting to ensure a reliable and scalable dedicated hosting solution for BigResource.com.







Read Text From A File


I have a text file which contains the following data

1&david&0248814&software engg&1973
2&thomas&8475623&commerse&1965

I have created a table <info> with the attributes
nr
name
reg_nr
sub
born_yr

I need to somehow read the data from the file n insert them into the table attributes...
does anyone over here know how could this be done ?
to insert the data to the table could be done with insert into <table> values <value> but the problem is how can i read it from the file...leaving the '&' sign ?


View Complete Forum Thread with Replies
Sponsored Links:

Related Messages:
READ A TEXT FILENAME
Since a text file can be loaded in the MySQL, I feel that there is a way MySQL will be able to read a text file name. Any idea how to do that? And after reading the text file name, how do i insert it in the column.

View Replies !   View Related
Read In A .sql File
I have a large SQL file that contains a bunch of create table statements.How do I get mysql to read in this file and process the sql. =20.I am not thinking load data infile because it isn't text

View Replies !   View Related
Read The .err File
Working on installation in Mac OSX 10.4. Need to read the .err file, but don't know how to find it. If you can help, please show the path from from the 'top' i.e. /usr/local/mysql/ and the rest of the path.

View Replies !   View Related
Can SQL Read From A File Or List
I'd like to do a select statement that would substitute variables from a file containing a list of strings, or a list of strings right on the command line. Here's my pseudo code:

SELECT {some value from my list, table or whatever} FROM {some list of tables in a file or other table etc}..

View Replies !   View Related
How To Read A File Into Mysql
i have created a output file from oracle which contains insert statements like

insert into tms.tms_rem_exclusion_list values (3337)
insert into tms.tms_rem_exclusion_list values (4175)
insert into tms.tms_rem_exclusion_list values (4227)

iam new to mysql and someone told me that if i create such a file
i can import this data into the mysql table at the mysql prompt

like
mysql> tms_rem_exclusion_list < test.sql; (name of the above file)

but iam getting this:

ERROR 1064: You have an error in your SQL syntax. Check the manual that corresp
onds to your MySQL server version for the right syntax to use near 'tms_rem_excl
usion_list < test.sql' at line 1

first of all i am not sure where to keep the test.sql file ie in which directory
so i kept it under the scripts folder.

View Replies !   View Related
Read Back Up File
I got this error.

shell> mysql -e "source /var/lib/mysql/test.sql" backuptest
ERROR 1044 (42000): Access denied for user ''@'localhost' to database 'backuptest'

View Replies !   View Related
Not Able To Read Mysqldump File Thru CLI
I am trying to do something like below

mysql -u root -p poll_only < poll.sql

poll.sql is a reasult of mysqldump nad i am trying to run and populate the database poll_only .

but nothing works out i am getting error
Access denied for user: 'root@localhost' to database 'poll_only'

i had given GRANT ALL poll_only.* username@localhost

but still no effect

View Replies !   View Related
Can Not Read My Database File *.frm
I have wamp server in my computer, i had some problem runing some of my file so i copied the database file from C:wampinmysqlmysql5.0.51adataitsal WHERE "ITSAL" IS THE NAME OF MY DATABASE and reinstall the wamp server, the problem now phpmydmin does not reconize these files which in this format: *.frm

or if any body know of any software i can use to read the structure of files with extension *.frm

View Replies !   View Related
Read Mysql Dump File?
I am trying to read a mysql dump file that I was given from a mysql dump file into my mysql server, I am using the following command at the mysql command line and get the following error:....

View Replies !   View Related
Mysqldump :: Read Password -p From .cnf File?
I want to do a simple mysqldump of a database. I know I can set up a cronjob to point to a script that runs

mysqldump -u username -pXXXXXXX db_name >mysql.backup

however I'm not happy with putting the password in the script. I've seen some suggestions on the web that you can use '-p hidden' and that this somehow reads from a .cnf file?

Am I worrying unecessarily here? I've looked through a number of books, but can't find a simple answer/ procedure to this.

View Replies !   View Related
Read The Contents Of A File In Linux
What is the shell command if I want to read the contents of .my.cnf file?

View Replies !   View Related
Login :: File To Read For Username And Password
What file is read for username and password, i know in the wizard you set this up but what file is read with the userames and passwords?

Ok i was reading that i can access the database via web interface i tried http://localhost:3307 but nothing ....

View Replies !   View Related
How To Force To Read The My.ini File In Windows - While Starting The Server
I have my my.ini inside the c: in windows 2000 and while starting the MySQL server (4.0.20), none of the variables declared in that file is getting reflected ...

Is there any way to make the server to read it by forcing.?

View Replies !   View Related
Need To Insert Data From A Text File Into A Medium Text Field.
How can I go about inserting data into a MEDIUMTEXT field from an existing text file using Java.

View Replies !   View Related
Insert Text File In A Text Field
2 questions:

1) How can I insert a text file into a TEXT field (of a table)
by a mysql instruction ?;

2) How can I insert a microsoft word file into a BLOB field (of a table)
by a mysql instruction?

View Replies !   View Related
Text File
I have a CSV text file. Is possible insert that file in mysql database from command line script running from console?

View Replies !   View Related
Using Text File
I am using the book "PHP and MySQL Web Development" by Sams Publishing to learn MySQL. The authors provide a CD with lots of source files in text format. They give a command to run or these files, but the path to the files is unclear. It just lists the file names and not any path from C: to the actual directory. I've tried specifying the full path from C:documents and settingsmy user name...file.sql but this does not work. I've also tried forward slashes.What do I do to specify the path to run a file to input commands in MySQL? Or how do I change the working directory to the place where the file is located?

View Replies !   View Related
Importing Text File
I am attempting to import data from a text file. There are many records
to be imported and the raw file format is:

"1 |010-5502-502 |16H1-7-3 |CONTACT, ELECTRICAL,
7/8in. |356.0000 |0.0000"
"1 |03-06-1062 |16H3-5-1 |RECEPTACLE,FREE
HANGING 6 CON.|1.0000 |0.0000"
"1 |03-06-2061 |16H2-8-2 |PLUG, POWER CONNECTOR
|3.0000 |0.0000"

Obviously, a delimiter is the | symbol. How can I do this?

View Replies !   View Related
Import A Text File
I have a utf8 txt file to import in a MySQL db, cause I must create a
web-application in PHP for reading this information on-line.
I have create a new DB in MYSQL 4.1.1a setting CHARACTER=utf8,
then I have create a table t1 with character set utf8 and some fileds
also with CHARACTER=utf8.
Then I imported the Txt file (really in UTF8 format, with 22600
records!) in my db. MySQL have imported the non-utf8 field correctly,
26000 records.
When I try to read this utf8 filed they appear like "???-?-???".
Then, also my PHP application show this field with stranges
characters. I have try also with PHPfunction utf8_encode with no
success

View Replies !   View Related
Help Importing W/o A Text File...
How can I import a database if I dont have a text file and its to late get one niether. I have only the folder that belongs to '...inmysqlmysql5.0.1bdataclassified', which I copied and moved from the backup folder to the new folder in its respectable place. The database, classified, is shown as database under phpMyAdmin with 11 in parentheses [ie. 'classified(11)']; which should mean there are 11 tables under the database name 'classified' but when I select the database there are no tables.

Side note: My computer crashed and was only able to recover the files and folders of the WAMP folder; that is the reason I cant make a text back-up file under phpMyAdmin. I am using WAMP2.0.

View Replies !   View Related
Import Text And Csv File
i want to import either text or csv file to database how can i do this..i have tried mysqlimport command but its giving some error

View Replies !   View Related
Inserting Text File
I've created a simple database that stores various little bits of information using varchar datatypes. But for each record i need to store a textfile that specifically has 60 characters per line. What i want to do is load the text in a way such that it remebers the new line characters, so that when i print it out on a webpage using perl cgi / dbi it prints the file out the way i want- i.e 60 characters per line and therefore multiple lines. Is there a way i can do this?

View Replies !   View Related
Loading From A Text File
I am using Xampp tool for a project which has to do with processing of lot of data. The problem is that hundreed thousands of data is generated every day in text file (comma separated or pipe separated doesnt matter) and all I want to do is to insert all these values in the appropriate tables. I looked for this feature in mysql GUI tools byt I couldnt find anything.
Another thing; Could be text file be imported automatically in any time we desire?

View Replies !   View Related
Data From A Text File
Objective:
Create a table that will contain the following five fields:
Number of song
Name of song
Artist of song
Musical category
Name of mp3
Then, to import all of this information from a .txt file into the database.

Here is the initial table I set up:
CREATE TABLE zanes_music
(song_num MEDIUMINT NOT NULL AUTO_INCREMENT,
song_title CHAR(80) NOT NULL,
song_artist CHAR(70) NOT NULL,
song_type CHAR(30),
song_file CHAR(85) NOT NULL,
PRIMARY KEY (song_num)
)TYPE=MyISAM;

Here is a typical line from the text file music.txt:

I"d Do Anything For Love (But I Won"t Do That), Meatloaf, Hard Rock, I"d Do Anything For Love (But I Won"t Do That.mp3,

What I need help with is the format to input the text file into the database. Do I put NULL, or something, in front of the name of the song, so that the database will count each song with an increment of 1 over the previous entry? Or do I need to modify the table some before it will accept data from a text file?

And would something like this work, or do I need to modify it:
LOAD DATA INFILE 'music.txt'
INTO TABLE zanes_music
FIELDS TERMINATED BY ','
LINES TERMINATED BY '
';

View Replies !   View Related
Parsing A Text File
i have a large formatted text file and i need to create a parser to put it into mysql database tables.Each entry has the same keywords, and everything after the ":" are changed for the different entries. The text file has the following format.

JN: Nature
IS: 398
TI: Humans use internal models to estimate gravity and linear acceleration
AU: Merfeld, Zupan + Peterka
PY: 1999

View Replies !   View Related
Creating DB From Text File...
I am trying to create a mysql db from a text using the DOS command prompt...
However, I keep getting errors...

I am using the following command under mysql/bin:

mysql -u root -p < mailman.sql ...

View Replies !   View Related
Text File Input
Just started to use mySQL and just also bought the mySQP Administrator's Guide - so sorry if simple question.
I need to create a new table with 25 columns, can I define this command line input via a text file?

i.e. instead of
mysql>CREATE New_Tab (col1_name, col1_type, etc....

I assume that you can use text files this way, but how do you run them.

I have seen the importing data from a file into a table;e.g.

mysql>load data local infile "myfile" into table New_Tab;

View Replies !   View Related
Text File Import
I'm importing a large text file (8 million lines) into a mysql table via the heidisql front end. Each line has 42 fields (tab separated) so there's a lot of data to bring in.

I tested the import with a truncated version of the text file (10,000 lines) and the import worked fine. It took about a minute (i think) to import. Now though, the full version (which is 800x as long) has been importing for nearly 48 hours. Heidisql seems to be still working - it hasn't frozen, it's busy.

Is it normal for a file of this size to take so long to import?

View Replies !   View Related
How To Import Text File?
I am using MAMP and am trying to import a large text file (up to 30mb) that is defined by position i.e., space 1-8 = ID, space 9-14 = Description, etc. The only option for import is via SQL or CSV file.

View Replies !   View Related
Re-write Text File
i'm creating a log file regarding database operations. My problem is i want to append a new record into the log file each time i update my database. Previously I've used the following method to create a file:

SELECT * INTO OUTFILE 'c:/"+fileName[i]+" '
FIELDS TERMINATED BY '|'
LINES TERMINATED BY '
'
FROM "+tableName[i]+";

MY problem is I cannot re-use the file created. Is there any way to call the same file for the purpose of re-use. Or maybe the OUTFILE do not allow file created to be re-use.

View Replies !   View Related
Tab Delineated Text File
I have a table and I'd like to output all the contents of the table to a tab delineated text file. What's the SQL command to do something like this?

View Replies !   View Related
Loading A Text File
To insert information into my tables ive been trying to create a .txt with all the information in. bit when i try to load it by entering
mysql> LOAD DATA LOCAL INFILE '/path/"name".txt' INTO TABLE "name"; it comes up with
ERROR 2 (HY000): File 'path"name".txt' not found (Errcode: 2)
ive been saving my .txt file onto the desktop.

View Replies !   View Related
Updating A Text File Using Php
well I have this text file "lingo.txt" that has a list of abbreviations which are used in a game I play. to make thing interactive i was hoping that visiters would be able to add there own abbreviation and the meaning of it to the "lingo.txt" file and then other people can download it

I know you can easily do this with a MySQL database (which I do have)but I wont them to be able to downlaod the list of words

I have found a way to update the file using the fwrite and fopen comands but thats deletes the last input where as i want them all save to a long list.

View Replies !   View Related
MySQL Import Text File Too Big?
Our production database in an exported textfil runs about 60 MB.
Compressed that's about 9 MB.

I'm trying to import the export into another machine running FC3 and
mySQL 11.18, and it appears as though the file may be too big!
When I try to do it via command line:

mysql -u root --host=localhost printing < ./printing.txt

It eventually errors out with a "syntax error on line X" and only about
half the tables get imported, and MyPHPAdmin GUI interface says it has
a 2MB file limit on importing.

This concerns me. If something were to happen to our production
database, how am I going to restore it?

I tried to do a search on mysql.com, but that's a less than helpful
site for support. A newsgroup search on the topic didn't come up with
much, so maybe I'm just bad at using keywords.

View Replies !   View Related
How To Create New Table From A Text File?
Is there a GUI utility which can create a new table in my mysql
database from a 50 million-record text file? I want mysql to get the
data into the database as whatever it can - varchar etc. I can change
columns later to double.... unless mysql is intelligent enough to see
that the field in the text file is numeric.

View Replies !   View Related
Data Import From Text File
When I try to import a text file with new data for an existing
table I get the error "1148 - the used command is not allowed
with this MySQL version."

I have tried with both PHPMyAdmin2.3 and with MySQLFront 2.5.
Both these GUI programmes have an "import from text file" command
which I have used successfully several times to add entries to
this table before - running just this MySQL version. I have
structured the data in the text file in just the same format as
previously.

Both these programmes are connecting to the database successfully
now and will display the contents of the existing table data and
strcutre of the database etc (despite an earlier connection
problem which seems to have been solved spontaneously).

But both now deliver exactly this error message (and therefore I
assume it is MySQL and not the interface programmes which is
doing it).I cannot see that I am doing anything different.

I have MySQL 4.0.12 on Windows ME PC with a local Apache server
and PHP.

View Replies !   View Related
Tab Delimited Text File Into Mysql
I wish to put a text file into a mysql table.
The text file entries are delimitated by tabs.
Example:

123 456 7 89
(That is, '123' is a data, '456' is a data but also '7 89' is a single data).

What command should I use?
I wish to use LOAD DATA INFILE but in wich way?
Something like

LOAD DATA INFILE "myfile.dat" into table01(a, b, c);

would be enought or I'll have only '7' and not '7 89'in row c?

View Replies !   View Related
Exporting Data Into A Text File
I have been able to create a text file on the MySQL host server using this technique .....

View Replies !   View Related
Cannot Ceate Database From Text File...
CREATE DATABASE dealership;
USE dealership;
CREATE TABLE users
(
requestid int(11) NOT NULL auto_increment,
firstname varchar(20) default NULL,
lastname varchar(20) default NULL,
city varchar(25) default NULL,
phone varchar(14) default NULL,
email varchar(25) default NULL,
username varchar(25) default NULL,
password varchar(50) default NULL,
PRIMARY KEY(requestid)
)

Instruction 2 is to save the file as dealership.sql...

Instruction 3 is to import dealership.sql into the MySQL engine using the following command:

mysql < C:workfolderexerciseschapter 18dealership.sql

View Replies !   View Related
DB Log Vs Text File Log And 1 Table Vs N Tables
1. Storing log in DB/Text file which mayb keep increaing every second. Which one is more feasible?

2. I hv a situation which to record the impression, the record keeps growing and should be huge one day, i wonder, spliting the same type of data into several tables like

impression_[month]_[day]

which will create different tables to store same type of data. Is it a good idea to reduce the select/insert time for the system?

View Replies !   View Related
Loading Text File Into Table
i created a table with the key attribute having an autoincrement property... i loaded a text file without the key attribute column to populate my table...but there's an error... but when i loaded the file with the key attribute column it doesnt post an error... how can i insert or load a text file without the key attribute column since it is already autoincremented?

View Replies !   View Related
Transfer Data To Text File
I need to transfer data from a table to a text file. I do not know how to get started.

View Replies !   View Related
Formatted Output To A Text File
I'd like to be able to write selected fields from a table to a csv text file. However, I need to be able to write some header lines to the file first, then the csv data, then some footer lines.

Question 1: What is the best way to do this. Using the SELECT ... INTO OUTFILE won't allow me to write the headers and footers. TEE includes the mysql> prompts, etc. There doesn't seem to be a straight forward fopen, printf sort of commands.

Question 2: How do you write a string like the header lines? PRINT doesn't seem to work.

View Replies !   View Related
Convert MySQL To Text File
Does anyone know how to convert a MySQL database to text file. I think it has to be converted to allow me to upload it onto my web host.

View Replies !   View Related
Stored Procedures From Text File.
I have written stored procedures using SQLyog. and I am running these stored procedures with the help of C#.Net. My C# program create tables and insert values with the help of C# using stored procedures.

But for this I have created the stored procedure in database with the help of SQLyog.Now if I want to run this C# program on some other m/c then I need to again create or copy or restore the stored procedure in the database ( which I dont want to do). My problem can be solved if I can save the stored procedure in some text file or some other file and then will create the stored procedures in database by using C# with the help of this text file.

View Replies !   View Related
Load Text File Into A Field
found examples about how to populate different fields from a text file (with MySQL, the LOAD DATA INFILE sentece)
http://dev.mysql.com/doc/refman/5.0/en/load-data.html


View Replies !   View Related
Formatting A Text File For Importing
I wish to import some data into MySQL through PHPmyAdmin. I have been searching for some code examples of how to format the text file,

until now I've ben using Oracle, who's format is as follows:

INSERT INTO tablename VALUES('attribute1', 'attribute2', 'attribute3');

But this isn't working for me, so was hoping someone could be so kind as to give me an example of how I should format the text file, in the manner like I've used above.

View Replies !   View Related
Warnings Loading A Text File...
mysql> LOAD DATA LOCAL INFILE '/path/pet.txt' INTO TABLE pet;

when i load the text file i get 7 warnings out of 8 rows... so i found out that there are some dates that are suposed to be NULL instead of the default 0000/00/00.

This is the content of my text file:

FluffyHaroldcatf1993-02-04N
ClawsGwencatm1994-03-17N
BuffyHarolddogf1989-05-13N
FangBennydogm1990-08-27N
BowserDianedogm1989-08-311995-07-29
ChirpyGwenbirdf1998-09-11N
WhistlerGwenbirdN1997-12-09N
Slim Bennysnakem1996-04-29N

& this is the output i get:

FluffyHaroldcatf1993-02-040000/00/00
ClawsGwencatm1994-03-170000/00/00
BuffyHarolddogf1989-05-130000/00/00
FangBennydogm1990-08-270000/00/00
BowserDianedogm1989-08-311995-07-29 // ok
ChirpyGwenbirdf1998-09-110000/00/00
WhistlerGwenbirdNULL1997-12-090000/00/00
Slim Bennysnakem1996-04-290000/00/00

So is something missing on my text file?

This is the MySQL version: 5.0.45-community-nt

View Replies !   View Related
Import From Delimited Text File
Our hosting provider has disabled mysqladmin. I'm looking for an alternative that will allow import of a text file into a table. I've looked at the MySQL GUI tool but it doesn't appear (at least I couldn't find it) to have an import option. Our needs are:

- it must be Windows based.
- it must be fairly simply to use
- it is just a single table
- connection to the database is to a remote server the web hosting company maintains

View Replies !   View Related
Executing SQL Script From A Text File
I am trying to run a SQL script from another SQL text file. I was successful in doing so by providing the complete path to the other sql script. I was wondering can I use the relative path in the master SQL text file instead of giving the complete system path of the other SQL scripts.

Something like this (assuming all the scripts are in the same folder):
CREATE SCHEMA IF NOT EXISTS TryDB1 DEFAULT
SHOW WARNINGS;
USE TryDB1;
SOURCE Script1.sql;
SOURCE Script2.sql;
.
.
.

View Replies !   View Related
Insert Text File Into MySQL
insert contents text file into MySQL database using java

View Replies !   View Related

Copyright © 2005-08 www.BigResource.com, All rights reserved