Welcome to the most active Linux Forum on the web.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 01-15-2010, 10:54 PM   #1
LQ Newbie
Registered: Dec 2009
Posts: 3

Rep: Reputation: 0
importing database in postgres

i have made a schema in postgres in which i want to import data from MS Excel sheet.Like in PHP there's no direct option of importing tables in database.plz suggest.

Another problem that i am facing is in making an audit trail of a table where i am trying to get primary key name and primary key value.i am unable to build the function properly.plz guide and if possible with the code.
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 01-16-2010, 07:19 AM   #2
Registered: Apr 2007
Location: Barcelona, Spain
Distribution: Debian, KUbuntu
Posts: 213

Rep: Reputation: 36
For DB importing:
  1. Save Excel table with CSV format, with tabs instead of commas
  2. Edit the file with a text editor
  3. Add a line before the data:
    COPY TableName (col1,col2,etc) FROM stdin;
  4. Add a line after the data:
    (backslash dot)
  5. Import the table as usual:
2 members found this post helpful.



Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Query a postgres database with Java cov Linux - Server 1 12-12-2009 09:29 AM
Starting a postgres database at boot kchakrak Linux - Software 1 01-08-2009 05:49 AM
Scripts updating a postgres database ethnicme Programming 1 07-15-2006 10:21 AM
create table in postgres database kranti Linux - Newbie 1 11-15-2005 06:52 PM
changing password for postgres database anjani.78 Linux - Software 1 07-18-2005 10:58 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:06 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration