<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[BIWEB开源PHP WMS系统创始人ArthurXF肖飞的blog]]></title> 
<link>http://www.bizeway.net/index.php</link> 
<description><![CDATA[网务通 - 网务公司发展之路]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[BIWEB开源PHP WMS系统创始人ArthurXF肖飞的blog]]></copyright>
<item>
<link>http://www.bizeway.net/read.php?</link>
<title><![CDATA[从postgresql 数据库中将一个表数据导入 mysql的方法]]></title> 
<author>ArthurXF &lt;arthurxf@gmail.com&gt;</author>
<category><![CDATA[PostgreSQL]]></category>
<pubDate>Wed, 01 Aug 2007 13:53:47 +0000</pubDate> 
<guid>http://www.bizeway.net/read.php?</guid> 
<description>
<![CDATA[ 
	1.从postgresql导出表结构，例如下面的结构<br/><div class="quote"><div class="quote-title">引用</div><div class="quote-content">--<br/>-- PostgreSQL database dump<br/>--<br/><br/>SET client_encoding = 'UTF8';<br/>SET check_function_bodies = false;<br/>SET client_min_messages = warning;<br/><br/>SET search_path = public, pg_catalog;<br/><br/>SET default_tablespace = '';<br/><br/>SET default_with_oids = false;<br/><br/>--<br/>-- Name: classes; Type: TABLE; Schema: public; Owner: jobzone; Tablespace: <br/>--<br/><br/>CREATE TABLE classes (<br/> &nbsp; &nbsp;cid smallint NOT NULL,<br/> &nbsp; &nbsp;gid character(1) NOT NULL,<br/> &nbsp; &nbsp;cname character varying(100) NOT NULL<br/>);<br/><br/><br/>ALTER TABLE public.classes OWNER TO jobzone;<br/><br/>--<br/>-- Name: pk_classes; Type: CONSTRAINT; Schema: public; Owner: jobzone; Tablespace: <br/>--<br/><br/>ALTER TABLE ONLY classes<br/> &nbsp; &nbsp;ADD CONSTRAINT pk_classes PRIMARY KEY (gid, cid);<br/><br/><br/>--<br/>-- Name: fk_classes_reference_groups; Type: FK CONSTRAINT; Schema: public; Owner: jobzone<br/>--<br/><br/>ALTER TABLE ONLY classes<br/> &nbsp; &nbsp;ADD CONSTRAINT fk_classes_reference_groups FOREIGN KEY (gid) REFERENCES groups(gid) ON UPDATE RESTRICT ON DELETE RESTRICT;<br/><br/><br/>--<br/>-- PostgreSQL database dump complete<br/>--</div></div><br/>2.选择出最重要的建表语句到mysql的数据库中执行，例如将下面的内容进行执行：<br/><div class="quote"><div class="quote-title">引用</div><div class="quote-content">CREATE TABLE classes (<br/> &nbsp; &nbsp;cid smallint NOT NULL,<br/> &nbsp; &nbsp;gid character(1) NOT NULL,<br/> &nbsp; &nbsp;cname character varying(100) NOT NULL<br/>);</div></div><br/>特别注意：如果表名有双引号的，一定要去除。<br/>3.从postgresql导出表纯数据，导出SQL格式的数据文件，例如：<br/><div class="quote"><div class="quote-title">引用</div><div class="quote-content">--<br/>-- PostgreSQL database dump<br/>--<br/><br/>SET client_encoding = 'UTF8';<br/>SET check_function_bodies = false;<br/>SET client_min_messages = warning;<br/><br/>SET search_path = public, pg_catalog;<br/><br/>--<br/>-- Data for Name: classes; Type: TABLE DATA; Schema: public; Owner: jobzone<br/>--<br/><br/>INSERT INTO classes VALUES (2750, 'C', '生物制品业');<br/>INSERT INTO classes VALUES (4183, 'C', '电子计算机修理业');<br/>INSERT INTO classes VALUES (100, 'A', '农业');<br/>INSERT INTO classes VALUES (2800, 'C', '化学纤维制造业');<br/>INSERT INTO classes VALUES (4189, 'C', '其他电子设备修理业');<br/>INSERT INTO classes VALUES (110, 'A', '种植业');<br/>INSERT INTO classes VALUES (2810, 'C', '纤维素纤维制造业');<br/>INSERT INTO classes VALUES (4190, 'C', '其他电子设备制造业');</div></div><br/>4.使用vi删除sql文件中下面的内容：<br/><div class="quote"><div class="quote-title">引用</div><div class="quote-content">-- PostgreSQL database dump<br/>--<br/><br/>SET client_encoding = 'UTF8';<br/>SET check_function_bodies = false;<br/>SET client_min_messages = warning;<br/><br/>SET search_path = public, pg_catalog;<br/><br/>--<br/>-- Data for Name: classes; Type: TABLE DATA; Schema: public; Owner: jobzone<br/>--</div></div><br/>如果有必要，就是使用vi替换命令:% s/"/`/g，将"替换成`符号。<br/>5.登录mysql,转换到你要导入的数据库，执行sql文件即可完成导入，下面例子仅作参考：<br/><div class="quote"><div class="quote-title">引用</div><div class="quote-content">#mysql -u root -p<br/>mysql>use jobzone<br/>mysql>&#92;. /aaa.sql</div></div><br/>Tags - <a href="tag.php?tag=postgresql" rel="tag">postgresql</a> , <a href="tag.php?tag=mysql" rel="tag">mysql</a>
]]>
</description>
</item><item>
<link>http://www.bizeway.net/read.php?&amp;guid=0#topreply</link>
<title><![CDATA[[评论] 从postgresql 数据库中将一个表数据导入 mysql的方法]]></title> 
<author> &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Thu, 01 Jan 1970 00:00:00 +0000</pubDate> 
<guid>http://www.bizeway.net/read.php?&amp;guid=0#topreply</guid> 
<description>
<![CDATA[ 
	
]]>
</description>
</item>
</channel>
</rss>