Duplicating a TABLE using Microsoft SQL Server Mangement

不羁岁月 提交于 2019-12-03 04:22:54
SQLMenace

In SSMS open a new query window and then do something like

SELECT * INTO NewTable
FROM OldTable

change NewTable to the name that the new table should have, change OldTable to the name of the current table

this will copy over the basic table structure and all the data...it will NOT do any of the constraints, you need to script those out and change the names in those scripts

I prefere the copy / paste solution as it is documented here. It works for Management Studio 2005 upwards. You just have to select all columns in the design then Edit -> Copy. Create a new table and the Edit -> Paste. This, at least, copies default values but of course doesn't copy the actual data.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!