Skip site navigation (1) Skip section navigation (2)

Re: convert text file to database

From: "Szentpali Janos" <ianus(at)easynet(dot)ro>
To: e-letter <inpost(at)gmail(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: convert text file to database
Date: 2008-04-22 10:03:30
Message-ID: 20080422100050.M37253@easynet.ro (view raw or flat)
Thread:
Lists: pgsql-novice
> I amended a copy of my csv files as follows:
>
2,OnlineGame,wwwflyordiecom,yyyy/mm/dd,1,player1,player2,0-1,normal,yyyy/mm/dd,1200,1d4d5...33Bf3Rxe50-1
>
3,OnlineGame,wwwflyordiecom,yyyy/mm/dd,1,player1,player2,0-1,normal,yyyy/mm/dd,1,player1,player2,1200,1e4d52e5d4...Nxf2#0-1
> Compared to my original csv file, I had to remove the field names that...

You can insert the full url with no special formating needed if you respect
the csv standard: it says strings should be enclosed in pairs of double quote
characters. So if you change

2,OnlineGame,wwwflyordiecom,yyyy/mm/dd,1,player1,player2,0-1,normal,yyyy/mm/dd,1200,1d4d5...33Bf3Rxe50-1
to

2,"OnlineGame","http://www.flyordie.com/","yyyy/mm/dd",1,"player1","player2","0-1","normal","yyyy/mm/dd",1200,"1d4d5...33Bf3Rxe50-1"

it will work. You can use other characters than double quote (") for string
delimiters; in that case you should use the QUOTE option of the CSV option to
specify the new string delimiter. If a string delimiter exists in the string,
it can be "escaped" by doubling it:

x said "Go away"

could be written as

"x said ""Go away"""

-- 
Szentpáli János



--------------------------------------------------

easynet.ro - Best free webmail service hosted by Idilis
.........................................................
Idilis - Internet Provider :: www.idilis.net
Inchiriem conexiuni radio si in zone neracordate la coloana - Broadband Wireless Idilis -



pgsql-novice by date

Next:From: Nils ZierathDate: 2008-04-22 12:46:03
Subject: Re: Remote / network connection fails
Previous:From: Nils ZierathDate: 2008-04-22 09:41:49
Subject: Re: Remote / network connection fails

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group