I want to copy and rename a table in SQL EXPRESS in an mdf database. Which is the best way to do this?
我想在mdf数据库中复制和重命名SQL EXPRESS中的表。这是最好的方法吗?
2 个解决方案
#1
3
Try a
select * into [newtablename] from [oldtablename]
which will make a copy of your old table with a new name.
这将使用新名称复制旧表。
#2
0
You can rename a table using sp_rename
. Note the warning (which will also appear when you run the stored proc):
您可以使用sp_rename重命名表。请注意警告(当您运行存储过程时也会出现警告):
Changing any part of an object name can break scripts and stored procedures.
更改对象名称的任何部分都可能会破坏脚本和存储过程。
#1
3
Try a
select * into [newtablename] from [oldtablename]
which will make a copy of your old table with a new name.
这将使用新名称复制旧表。
#2
0
You can rename a table using sp_rename
. Note the warning (which will also appear when you run the stored proc):
您可以使用sp_rename重命名表。请注意警告(当您运行存储过程时也会出现警告):
Changing any part of an object name can break scripts and stored procedures.
更改对象名称的任何部分都可能会破坏脚本和存储过程。