Friday 22 February 2013

How to copy stucture from a table ? How to copy stucture and data from a table ?

This article i help to you how to copy metadata(stucture) or metadata and data from a table. I will explain in oracle and teradata.

Oracle : Here i have a emp table. I want to copy emp data and stucture. Here is the solution to copy emp data and stucture.

Query: Create table emp_t as select * from emp where 1=1  ( in oracle)

Query: create table emp_t as (select * from emp) with data  ( in Teradata )

if you want copy only structure of emp table.Run the below query.

Query: create table emp_t as select * from emp where 1=2    ( in oracle )

Query: create table emp_t as (select * from emp) with no data (in Teradata)


drop your comments here if you know any other way to copy stucture and data.




1 comment: