473,771 Members | 2,365 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Is there an easy to copy a table: structure and data?

For testing purposes I propose to add a schema (testing, how original)
and would like to copy some of my live tables to it, both structure and
data. I know I could use something like dump/restore for the data and
Quest's (BTW this a very nice product) 'create like' function. That
would work, but it seems a lot of work for something DB2 should know how
to do.

Nov 12 '05 #1
4 38883
db2look with -e -t can give you the table CREATE statements.

The DB2 Control Center will allow you to copy a table and its contents.

You can also do a CREATE ... LIKE to copy the table structure (but not
the rows):

create table emp2 like employee

you could then do an insert:

insert into emp2 (select * from employee)

Robert Stearns wrote:
For testing purposes I propose to add a schema (testing, how original)
and would like to copy some of my live tables to it, both structure and
data. I know I could use something like dump/restore for the data and
Quest's (BTW this a very nice product) 'create like' function. That
would work, but it seems a lot of work for something DB2 should know how
to do.


Nov 12 '05 #2
db2look with -e -t can give you the table CREATE statements.

The DB2 Control Center will allow you to copy a table and its contents.

You can also do a CREATE ... LIKE to copy the table structure (but not
the rows):

create table emp2 like employee

you could then do an insert:

insert into emp2 (select * from employee)

Robert Stearns wrote:
For testing purposes I propose to add a schema (testing, how original)
and would like to copy some of my live tables to it, both structure and
data. I know I could use something like dump/restore for the data and
Quest's (BTW this a very nice product) 'create like' function. That
would work, but it seems a lot of work for something DB2 should know how
to do.


Nov 12 '05 #3
Blair Adamache wrote:
db2look with -e -t can give you the table CREATE statements.

The DB2 Control Center will allow you to copy a table and its contents.

You can also do a CREATE ... LIKE to copy the table structure (but not
the rows):

create table emp2 like employee

you could then do an insert:

insert into emp2 (select * from employee)

Robert Stearns wrote:
For testing purposes I propose to add a schema (testing, how original)
and would like to copy some of my live tables to it, both structure and
data. I know I could use something like dump/restore for the data and
Quest's (BTW this a very nice product) 'create like' function. That
would work, but it seems a lot of work for something DB2 should know how
to do.


Another alternative would be to take an EXPORT to IXF format, and then do an
IMPORT with the "REPLACE_CREATE " option. This would work across databases
as well. It will only give you the basic table structure and data, and
you'd need to use db2look to generate the statements to add indexes etc.

HTH

Phil
Nov 12 '05 #4
Blair Adamache wrote:
db2look with -e -t can give you the table CREATE statements.

The DB2 Control Center will allow you to copy a table and its contents.

You can also do a CREATE ... LIKE to copy the table structure (but not
the rows):

create table emp2 like employee

you could then do an insert:

insert into emp2 (select * from employee)

Robert Stearns wrote:
For testing purposes I propose to add a schema (testing, how original)
and would like to copy some of my live tables to it, both structure and
data. I know I could use something like dump/restore for the data and
Quest's (BTW this a very nice product) 'create like' function. That
would work, but it seems a lot of work for something DB2 should know how
to do.


Another alternative would be to take an EXPORT to IXF format, and then do an
IMPORT with the "REPLACE_CREATE " option. This would work across databases
as well. It will only give you the basic table structure and data, and
you'd need to use db2look to generate the statements to add indexes etc.

HTH

Phil
Nov 12 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1843
by: QWERTY | last post by:
--------------Boundary-00=_O5I3QL80000000000000 Content-Type: Multipart/Alternative; boundary="------------Boundary-00=_O5I3LVC0000000000000" --------------Boundary-00=_O5I3LVC0000000000000 Content-Type: Text/Plain; charset="iso-8859-9" Content-Transfer-Encoding: quoted-printable
0
2441
by: Randall Sell | last post by:
Hello all, I am migrating a Paradox application to SQL Server. My problem is that the existing Paradox table structure is limited. Correcting it will mean a re-write of the application (Delphi app). Although the record and column limits are higher in SQL Server, it will eventually hit the wall. So I was wondering if anyone could offer advise on how we might do this best.... The application is essentially an evaluation tool. It is very...
2
10417
by: spamproof2005 | last post by:
Is there a way to copy the structure from one database to another without affecting the actual data? For example, I added new fields and stored procedures to a db in my development environment. There are a lot of them. I now want to make the same changes to my production environment db but don't want to affect the data. Only the fields, stored procs & constraints and stuff pertaining to the structure of the db should be changed.
5
2071
by: Stewart Allen | last post by:
Hi all, I'm designing a club database and have encountered a problem when trying to extract the total amount of fees that a Student/Family is suppose to pay during their time of membership. I've already designed the tables and relationships but I want your advice to see if my design was right. In my older version a member pays the fees but when there's 2 or more members that belong to a family (brother, sister, mother, father etc),...
3
2997
by: Leo Nunez | last post by:
Hello! I need copy from structure "A" to "B" that contains "strings" in a one line code. Me problem like this : typedef struct tHeader{ char field1; char field2; char field3;
1
4058
by: Mo | last post by:
Hi, I have two datasets on two databases one remote and one local. I am trying to copy the local data into the remote. Both tables have the same structure. I use the following DataTable Remote_Table = new DataTable(); Remote_Table = dsRemote.Tables.Clone(); DataRow DR_Local = dsLocal.Tables.Select(); foreach(DataRow Local_Data in(DR_Local))
2
13930
by: charles-brewster | last post by:
I'm trying to write a simple JavaScript function which will use a button to copy table cell data into a form input text box as the "value" attribute. The following is intended to test the function, but doesn't work. I'm new to this - previous JavaScript experience mostly copy & paste - could somebody please point to where I'm going wrong. ~~~~~~~~~~~~~~~~~~~~~~~~~ <head>
3
2491
by: jc | last post by:
Hello. I want to ask about the possibility of copying both a table structure and it's contents from a SQL server table to a table within MS access. The problem cannot be solve with a permanent table structure at the target location. The names of the columns are essentially data with the application and so are subject to change. I am targeting a solution using SQL Query Manager. The approach I have tried (with failure) is SELECT *
9
1737
by: sck10 | last post by:
Hello, I am building a web form that will be used to gather information for marketing plans. The form will have 15 questions which must be answered. Each question can have large blocks of text. The issue is that the user will go to the web to enter and update their information over time, so all the questions need to be on one form. I believe the proper structure for the table would be: MarketingRequest
0
10261
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
10103
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9911
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8934
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
7460
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
6713
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();...
0
5482
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4007
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
3
2850
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.