Home > DeveloperSection > Forums > create a new table from another table
Pawan kumar
Pawan kumar

Total Post:19

Points:133
Posted on    March-10-2011 8:59 AM

 MSSQL Server MSSQL Server 
Ratings:


 2 Reply(s)
 1261  View(s)
Rate this:
sir i want to create new table from another table (only structure of table) and then record of table.


Alex R
Alex R

Total Post:40

Points:280
Posted on    March-11-2011 12:41 AM


Shankar M

Total Post:25

Points:175
Posted on    April-09-2013 10:13 PM

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


Don't want to miss updates? Please click the below button!

Follow MindStick