I want to know how to create duplicate table from table stored in database in SQL Server.
Thank you.
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
Pankajkumar PatelRank #181 · 13.4K reputationPosted Nov 16, 2021, 9:43 AM EST
Hi Vipendra Verma,
There are two ways to create duplicate table from table stored in database in SQL Server:
For more details:
Hope, this will help you!
Satyapriya NayakRank #47 · 31.5K reputationPosted Jun 27, 2012, 4:02 AM EDT
If we want to copy the structure only
SELECT TOP 0 * INTO newtable FROM oldtable
SELECT TOP 0 * INTO employee1 FROM employee
If we want to copy the structure as well as records
select * into newtable from oldtable
SELECT *
INTO employee1
FROM employee
Thanks
Santhosh Kumar JayaramanRank #563 · 4.3K reputationPosted Jun 27, 2012, 4:05 AM EDT
you can create using the below query
select * into teamsnew from teamsold.
Here teamsold-existing table and teamsnew-new one to be created.
But remember it will copy the columns and rows but keys and constraints wont be copied. Best way to achieve this is get table creation script from db and rename the table and keys, constraints name and run it,.
Vinitha TRank #8,005 · 230 reputationPosted Nov 16, 2021, 8:47 AM EST