We can create a table from another table definition but without data in DB2. We need write a another sql to insert the data into newly created table.
Let's see how to do this --
Create Duplicate table with NO DATA
-----------------------------------------------------------------------------------------------------------
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Create table from another table definistion | |
create table tab1 as ( select col1, col2 from table2 ) with no data ; |
Insert data into duplicated table from original table
-----------------------------------------------------------------------------------------------------------
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Insert data into duplicated table from original table | |
insert into tab1 select col1, col2 from table2 ; |
Like the Facebook Page & join Group
https://www.facebook.com/DataStage4you
https://www.facebook.com/groups/DataStage4you
https://twitter.com/datastage4you
https://groups.google.com/d/forum/datastage4you
For WHATSAPP group , drop a msg to 91-88-00-906098
No comments :
Post a Comment