Hi....
Can I create a table from another table in SQL SERVER, if yes then to how ?
Thanks...
Nested Table
4 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Javeed M ShaikhRank #839 · 2.7K reputationPosted Nov 8, 2011, 2:01 PM EST
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.
Sam HobbsRank #107 · 20.5K reputationPosted Nov 8, 2011, 1:36 PM EST
Pravin MoreRank #1,419 · 1.2K reputationPosted Nov 8, 2011, 6:41 PM EST
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.
Vineet Kumar SainiRank #257 · 9.8K reputationPosted Nov 28, 2011, 1:40 PM EST