I am in the process of converting a database from MS SQL Server to PostgreSQL and I am having a few problems getting the data in to postgreSQL.
Basically i've read up on it and got a few examples of using the COPY command, but I'm sure I'm missing something because no matter what syntax I use I am still unable to insert the data from a CSV file from SQL Server into PostgreSQL.
What I would really appreciate is if someone has a decent link to one, with example or if someone can give me a quick example here of how to do it. For example, if I want to get the data from a file called data.csv into a table called table1 then I've been trying :
COPY table1 FROM 'c:/data.csv'
The error varies each time, but it's not actually giving an error message as such, and I dont know whether it's because I'm not specifying the correct paramaters or whether I need to not have a table in the database already, or whether I need row headers in the CSV file or something?
Any help you can give would be great,
Now, in the oldest of the three conversion articles from SQL Server to PostgreSQL, Ian Harding discusses using COPY to import the data. He DOES mention that SQL Server uses lf and cr as the end of line (newline) terminator, whereas postgreSQL uses lf character only.
Last edited by loquin; 03-20-07 at 16:12.
"Lisa, in this house, we obey the laws of thermodynamics!" - Homer Simpson
"I have my standards. They may be low, but I have them!" - Bette Middler
"It's a book about a Spanish guy named Manual. You should read it." - Dilbert