CREATE A NEW TABLE FROM ANOTHER TABLE

Pawan kumar

Total Post:19

Points:133
Posted by  Pawan kumar
 1487  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. 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

Answer

NEWSLETTER

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