[MySQL]Loading a text file into ue table

Last update on July 20, 2009 08:41 AM by jak58
Published by jak58

[MySQL]Loading a text file into ue table







To load a text file as follows:

$ tail /home/user1/test.txt
	  'name1',1,9
	  'name2',2,3
	  'name3',3,54
	  'name4',4,2
	  'name5',5,9

In a table defined as follows:

CREATE TABLE chargertest (
                prim_key int(11) NOT NULL auto_increment,
                name varchar(20),
                x integer,
                y integer,
                z timestamp(14),
                Constraint pk_chargertest PRIMARY KEY  (prim_key)
); 

Note that the 'z' is not defined in the text file and the separator is','.

mysql> load data infile '/home/user1/test.txt' into table chargertest fields terminated by ',' (name,x,y);
Best answers for « Loading a text file into ue table » in :
[Linux]Cutting a file into several parts Show [Linux]Cutting a file into several parts Linux is full of utility tools allowing you to manipulate files. There is a very handy tool to split a file into several parts (for example to carry data on low capacity media). The split...
Writing in batch in text file ShowWriting in batch in text file To write in a file text, you just have to use a redirect: echo text > output_file.txt To write in an existing file: echo " Write at the end of the file ">> output_file.txt
Converting your PDF file into an Image ShowConverting your PDF file into an Image Universal Document Converter PDF2IMAGE PDF TO IMAGE CONVERTER You could have encountered difficulties to modify PDF docs in the past. Nowadays this is no more trouble as there are several PDF...
[Office 2007] Convert MS Office files into PDF Show[Office 2007] Converting MS Office files into PDF Here is how to create PDF files from any Microsoft Office 2007: Microsoft Excel: xls, xlsx, xlsb Microsoft Access: accdb Microsoft Word doc, docx, rtf Microsoft PowerPoint:...
Download Join (Merge) Text Files Software ShowDescription The application is designed by Sobolsoft. Simple and easy to use, the application has been awarded from various places. Join Text Files a tool that enables you to merge several files. It allows you to merge multiple text files into a...
HTML Markup ShowHTML, A Markup Language HTML is not a programming language. Rather, it is used for describing the layout and format of content, written in the form of simple text. An HTML page is a basic text file containing tags for specifying text format,...
Managing images in HTML ShowHow do you display images on a web page? Having a few images on a website can make it more attractive and user-friendly. However, it is important not to go overboard, since images can take a long time to load, and in some cases can make a document...
Using FTP commands ShowThe FTP protocol FTP (File Transfer Protocol) is a protocol — meaning a standard language that lets two machines communicate — used so that computers of different types (or with different operating systems) can transfer files over a...