473,749 Members | 2,463 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

need copy table sql example in postgres

1 New Member
hi all


i use postgresql database.

There are two databases in that namely 'db1','db2'.

In 'db1', thers is a table named as 'table_common'.

In 'db2', there is a table named as 'table_common'.

In both databases, the table 'table_common' is identical with fields.

In 'db1', the 'table_common' has data(1000 rows). But in 'db2', the table has no data(0rows).

I am in situation to use 'copy table' sql here.

please help me to copy data of table_common in db1 to table_common in db2.

very urgent.

Advance thanks.

N.Prabhu
Mar 1 '07 #1
1 8280
michaelb
534 Recognized Expert Contributor
If this is a one-time operation you can use pg_dump to create the datafile off this table, then you can load this file into another database.
If you need this functionality on a permanent basis you can use dblink:

http://www.postgresql.org/docs/8.0/i...pressions.html
http://developer.postgresql.org/cvsw...ontrib/dblink/
http://pgfoundry.org/projects/dblink-tds/
Mar 1 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
2111
by: cbb | last post by:
I'm using ver. 7.4.6.1 from a generic install of Fedora Core 3. I always get "permission denied" error when using the COPY command to load to a table from a text file. I'm logged on to the db as Postgres, have file permissions set to RW-R--R--, and it is located in /tmp (also tried putting it in the Postgres home directory). I am able to use the insert command successfully on the same table, so it's not a db permission problem. Any...
0
1330
by: Dennis Gearon | last post by:
There doesn't seem to be any way to embed the name of the fields in a text file for either MySQL or Postgres. So, for example, if I had a tab delimited table of all my MP3's on a Win32 partition as well as all the MP3's on my laptop and I wanted to access them from a php/postgres application from either windblowsXP on one partition or Linux on another Application, I can't embed the name of the fields in the text table. I'd have to use...
1
5627
by: Knepper, Michelle | last post by:
Hi out there, I'm a first-time user of the "Copy ... From..." command, and I'm trying to load a table from a text flat file. http://www.postgresql.org/docs/7.4/static/sql-copy.html I don't know if I'm using the command correctly. Question: I run this command as a superuser, and the "copy from" command is run like a SQL command on the command line, correct?
2
2921
by: Knepper, Michelle | last post by:
Hi, I'm a first-time user of the "Copy ... From..." command, and I'm trying to load a table from a text flat file. http://www.postgresql.org/docs/7.4/static/sql-copy.html I'm getting the following error. Any help will be appreciated. Thank you.
2
2671
by: Janning Vygen | last post by:
hi PGurus, i searched the archives and read the docs, because this problem shouldn't be new. But i really don't know what to search for. i am populating a database (v7.4.1) with COPY. Some triggers in the db schema fire on inserts and do some additional data manipulations, which i dont want to take place by running COPY because my data don't need those additional manipulation. Therefor and for performance reasons, i disable all...
4
1821
by: David A. Ulevitch | last post by:
Hi fellow pgsql users, I am helping my university's student union get back up and running after some major server issues they had. They had serious disk issues on a server, but not on the /var partition where all of the /var/lib/postgres/data files were. I was able to recover all of it, at the file-system level. The old machine and the new machine were both running Debian Linux 3.0-stable and postgresql 7.2.1-2woody4.
14
5761
by: David Suela Fernández | last post by:
Hi! Is it possible to copy/migrate one database from one postgres server to other copying just the files in /var/lib/postgres/data/ ? I can't use pg_dump because it give me an error. I think than the instalation of postgres is corrupt because it give me a lot of error like "ERROR: relation "pg_catalog.pg_user" does not exist". Thanks,
4
2233
by: frederic.germaneau | last post by:
I'm trying to stress PostgreSQL 8beta3 on AIX5.2 with TPCH 1 Go I have created and configurated a database on 2 tablespaces : first one for indexes and second one for tables First script for database creation: $ more scrCreateDataBase.sh psql template1<<! create tablespace dataTbl location '/postgres_data/TpchDataTableSpace'; create tablespace indexTbl location '/postgres_data/TpchIndexTableSpace';
9
10036
by: David Rysdam | last post by:
I have a large amount of data that I copy in and out of Sybase very often. Now I also want to copy this data in and out of postgres. I have an existing script that creates the entire database(s) from scratch in Sybase and then uses the Sybase bulk copy tool "bcp" to copy the data in. I already did a brute force port of this script to postgres once, but I'm trying to do it more elegantly now that I know what issues I'm going to run...
0
8996
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8832
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9566
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8256
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6800
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6078
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3319
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2791
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2217
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.