-
I want to use only one query - the problem is: how to create new table from existing table in sql server0
-
Member • Nov 12, 2010
create table newtable_name like database_name.old_table_name;
insert into newtable_name selcet * from database_name.old_table_name;
This will copy your previous table to new table. Happy computing.Are you sure? This action cannot be undone. -
Member • Nov 12, 2010
create table new-table-name (column-list) as select (column-list) from existing-table-name;
What's this then?Are you sure? This action cannot be undone. -
Member • Nov 12, 2010
In Oracle,
Create table temp as select * from old table. -- will this not do?Are you sure? This action cannot be undone. -
Member • Nov 12, 2010
This is same as the query I have given.English-ScaredIn Oracle,
Create table temp as select * from old table. -- will this not do?
create table new-table-name (column-list) as select (column-list) from existing-table-name;
In your query, temp is the new-table-name and old table refers to the existing-table-name. I had specified the column-list to select particular columns and you used * to select all the columns, Isn't it?
This will definitely works.Are you sure? This action cannot be undone. -
Member • Nov 13, 2010
select * into table_new from table_old
this query work in sqlserver,but i have no idea that about, this will work in oracle,mysql or notAre you sure? This action cannot be undone. -
Member • Nov 13, 2010
Suppose u have table employee having cols eno, ename, salary and adress, now for making exact copy of that table of name emp2 the following query can be used
create table emp2(eno int, ename varchar(50), salary int, address varchar(50)) select eno , ename , salary , address from employee;
(tested)Are you sure? This action cannot be undone.