GreenCat
GreenCat

Reputation: 167

Import file.xml to postgresql 9.3,copy all data including header

how to import data *.xml(taken from sql server)

some of the xml file

To

PostgreSQL 9.3..Already create table with same column XML.now problem to maping data.any help.

thanks you

Upvotes: 0

Views: 1179

Answers (1)

Craig Ringer
Craig Ringer

Reputation: 324821

If you want to import an XML document into PostgreSQL, simply:

CREATE TABLE mytable(mydata xml);

INSERT INTO mytable(mydata) VALUES ('<?xml version="1.0"?>
<ROOT>
  <xsd:schema ....>')

If you instead want to take an XML document and extract its contents into a set of related tables, there's no automagic way to do that. Look at Talend Studio, Pentaho Kettle, CloverETL, and the large variety of XML import utility scripts and tools out there. No matter how you do it, you'll have to define some kind of schema mapping from your XML document to the PostgreSQL schema you wish to load the document contents into.

Upvotes: 2

Related Questions