Hi....
Can I create a table from another table in SQL SERVER, if yes then to how ?
Thanks...
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Javeed M ShaikhPosted Nov 8, 2011, 7:01 PM
The following command will create a table with data based from an existing table:
CREATE TABLE new_table
AS (SELECT * FROM old_table);
The following command will create a table without data from an existing table:
CREATE TABLE new_table
AS (SELECT * FROM old_table WHERE 1=2);
remember you can give specific column names in the select also if you want to create the new table with certain columns.
Vineet Kumar SainiPosted Nov 28, 2011, 6:40 PM
Pravin MorePosted Nov 8, 2011, 11:41 PM
use this......
Select * into Table_new from table_old
this will insert records into Table_new if it already exist otherwise it will create new table with that name if not exist.
Thanks,
Pravin.
Sam HobbsPosted Nov 8, 2011, 6:36 PM