CREATE A NEW TABLE FROM ANOTHER TABLE

Pawan kumar

Total Post:18

Points:126
Posted by  Pawan kumar
 1688  View(s)
Ratings:
Rate this:
sir i want to create new table from another table (only structure of table) and then record of table.
  1.   Modified On Mar-29-2018 11:58:13 PM
  1. Shankar M

    Post:25

    Points:175
    Re: create a new table from another table

    Hi Pawan,

    You can try, 
    In SQL Server,

    SELECT * INTO NEWTABLE FROM OLDTABLE WHERE 1 = 0
    In Oracle (CTAS -Create Table as Select)
    CREATE TABLE NEWTABLE AS SELECT * FROM OLDTABLE WHERE 1 = 0

    Here 1 = 0 is the condition that is never satisfied, So the data is not inserted into the new table.

    Thanks,
    Shankar

      Modified On Mar-29-2018 11:58:35 PM

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!