create a new table from another table

Total Post:18

Points:126
 1788  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. 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