<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Ali&#039;s Blog &#187; MySQL</title>
	<atom:link href="http://www.almahdi.cc/category/mysql/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.almahdi.cc</link>
	<description>Made from the best stuff on earth</description>
	<lastBuildDate>Tue, 24 Jan 2012 10:16:23 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>Loading fixed width lines in MySQL</title>
		<link>http://www.almahdi.cc/mysql/loading-fixed-width-lines-in-mysql/</link>
		<comments>http://www.almahdi.cc/mysql/loading-fixed-width-lines-in-mysql/#comments</comments>
		<pubDate>Tue, 11 Jan 2011 09:28:37 +0000</pubDate>
		<dc:creator>Ali</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Ali]]></category>
		<category><![CDATA[Ali Almahdi]]></category>
		<category><![CDATA[ali almahdi blog]]></category>
		<category><![CDATA[ali almahdi twitter]]></category>
		<category><![CDATA[ali blog]]></category>
		<category><![CDATA[Almahdi]]></category>
		<category><![CDATA[linux replace text]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://almahdi.cc/?p=460</guid>
		<description><![CDATA[Today I required to load a file into a database, the file requires some parsing to be loaded. Normal developer would load the file using a programming language, do the parsing and insert into the table. However, for me, I thought I would do it using MySQL DATA LOAD, it is faster and yet, no [...]]]></description>
			<content:encoded><![CDATA[<p>Today I required to load a file into a database, the file requires some parsing to be loaded. Normal developer would load the file using a programming language, do the parsing and insert into the table. However, for me, I thought I would do it using MySQL DATA LOAD, it is faster and yet, no programming language required to load the files.</p>
<p>I am posting a sample code on how to parse files line by line using MySQL.</p>
<blockquote>
<div id="_mcePaste">LOAD DATA LOCAL INFILE &#8216;path/to/my/file&#8217; into table [table-name]</div>
<div id="_mcePaste">(@line)</div>
<div id="_mcePaste">set field1 = SUBSTR(@line,1,10),</div>
<div id="_mcePaste">field2 = SUBSTR(@line, 11,12),</div>
<div id="_mcePaste">field3 = SUBSTR(@line, 48,19)</div>
</blockquote>
<p>Now, what I did, is I just parsed text, since the file was not delimited but it had fixed width.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.almahdi.cc%2Fmysql%2Floading-fixed-width-lines-in-mysql%2F&amp;title=Loading%20fixed%20width%20lines%20in%20MySQL" id="wpa2a_2"><img src="http://www.almahdi.cc/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.almahdi.cc/mysql/loading-fixed-width-lines-in-mysql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Load Delimited Data into MySQL</title>
		<link>http://www.almahdi.cc/mysql/load-delimited-data-into-mysql/</link>
		<comments>http://www.almahdi.cc/mysql/load-delimited-data-into-mysql/#comments</comments>
		<pubDate>Mon, 30 Mar 2009 10:44:40 +0000</pubDate>
		<dc:creator>Ali</dc:creator>
				<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://almahdi.cc/mysql/load-delimited-data-into-mysql/</guid>
		<description><![CDATA[How to load Data from a CSV or any delimited file to MySQL: LOAD DATA LOCAL INFILE &#8216;/path/to/file/name&#8217; INTO TABLE `tablename` FIELDS TERMINATED BY &#8216;,&#8217; LINES TERMINATED BY &#8216;\n&#8217;; Keeping in mind that the delimited used here is , so FIELDS TEMINATED BY &#8216;,&#8217; You can change the delimiter to any thing your data have.]]></description>
			<content:encoded><![CDATA[<p>How to load Data from a CSV or any delimited file to MySQL:</p>
<blockquote><p>LOAD DATA LOCAL INFILE &#8216;/path/to/file/name&#8217; INTO TABLE `tablename` FIELDS TERMINATED BY &#8216;,&#8217; LINES TERMINATED BY &#8216;\n&#8217;;</p></blockquote>
<p>Keeping in mind that the delimited used here is , so FIELDS TEMINATED BY &#8216;,&#8217;</p>
<p>You can change the delimiter to any thing your data have.</p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fwww.almahdi.cc%2Fmysql%2Fload-delimited-data-into-mysql%2F&amp;title=Load%20Delimited%20Data%20into%20MySQL" id="wpa2a_4"><img src="http://www.almahdi.cc/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.almahdi.cc/mysql/load-delimited-data-into-mysql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

