Hi,
I have two tables. Table-X and Table-Y. Both tables have same number of columns and of same data type for the columns in them. Basically they are replica of each other. Now, I need to copy the rows from Table-X to Table-Y. I think I can use INSERT in a different way here so that using a single INSERT I can use update both the tables. Please guide, if using a single insert I can take data from Table-X and copy it in to Table Y? Any pointers are greatly appreciated.
Insert data from one table to another in DB2 on mainframes.
-
- Registered Member
- Posts: 11
- Joined: Tue Dec 22, 2015 2:30 pm
Re: Insert data from one table to another in DB2 on mainframes.
Look at the syntax of the INSERT verb.
Regards
Nic
Nic
-
- Global Moderator
- Posts: 588
- Joined: Wed Nov 20, 2013 11:53 am
- Location: Mars
Re: Insert data from one table to another in DB2 on mainframes.
Also you could try UNLOAD and LOAD
zprogrammer
-
- Registered Member
- Posts: 11
- Joined: Tue Dec 22, 2015 2:30 pm
Re: Insert data from one table to another in DB2 on mainframes.
Thanks. I can do that but I am thinking if we can use INSERT itself to do that. I am reading through the INSERT statement to make it work. Thanks for the answers.Pandora-Box wrote:Also you could try UNLOAD and LOAD
-
- Global Moderator
- Posts: 588
- Joined: Wed Nov 20, 2013 11:53 am
- Location: Mars
Re: Insert data from one table to another in DB2 on mainframes.
As Nicc mentioned you could use insert statement
But if there are more records it is better to have frequent commits or as an alternative you could unload and load data
But if there are more records it is better to have frequent commits or as an alternative you could unload and load data
zprogrammer
Create an account or sign in to join the discussion
You need to be a member in order to post a reply
Create an account
Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute