i have a database and want to copy all the tables in new database without copying the dat of all those tables only structure should be copy
我有一个数据库,并希望复制新数据库中的所有表,而不复制所有这些表的数据只有结构应该是复制
3 个解决方案
#1
2
SQL Server Management Studio offers the following:
SQL Server Management Studio提供以下内容:
Scripting the whole database:
脚本编写整个数据库:
- Under the Object Explorer, right mouse click on the database and then select
Script Database as
在对象资源管理器中,右键单击数据库,然后选择“脚本数据库”
To script just (specific) tables:
仅编写(特定)表的脚本:
- In Object Explorer, right mouse click on the database, select
Tasks
, thenGenerate Scripts
, and then select the tables that you want.
在对象资源管理器中,右键单击数据库,选择“任务”,然后选择“生成脚本”,然后选择所需的表。
You can then use the script to create a new database / new objects elsewhere. If you change the name of the database, remember to change the USE xxx
statement(s) accordingly.
然后,您可以使用该脚本在其他位置创建新数据库/新对象。如果更改数据库的名称,请记住相应地更改USE xxx语句。
#2
0
In SSMS for your first database right click on the datbaase name then "Script Database as" > "CREATE To" then choose your output location and run your script.
在第一个数据库的SSMS中右键单击datbaase名称,然后单击“Script Database as”>“CREATE To”,然后选择输出位置并运行脚本。
Edit:
Note you will need to amend the script to specify the new database name, replacing the existing one in the generated script (courtesy of Oded comment).
请注意,您需要修改脚本以指定新的数据库名称,替换生成的脚本中的现有名称(由Oded评论提供)。
#3
0
In the SQL server Management Studio you can right click the database -> tasks -> export data. Then follow the wizard..
在SQL Server Management Studio中,您可以右键单击数据库 - >任务 - >导出数据。然后按照向导..
#1
2
SQL Server Management Studio offers the following:
SQL Server Management Studio提供以下内容:
Scripting the whole database:
脚本编写整个数据库:
- Under the Object Explorer, right mouse click on the database and then select
Script Database as
在对象资源管理器中,右键单击数据库,然后选择“脚本数据库”
To script just (specific) tables:
仅编写(特定)表的脚本:
- In Object Explorer, right mouse click on the database, select
Tasks
, thenGenerate Scripts
, and then select the tables that you want.
在对象资源管理器中,右键单击数据库,选择“任务”,然后选择“生成脚本”,然后选择所需的表。
You can then use the script to create a new database / new objects elsewhere. If you change the name of the database, remember to change the USE xxx
statement(s) accordingly.
然后,您可以使用该脚本在其他位置创建新数据库/新对象。如果更改数据库的名称,请记住相应地更改USE xxx语句。
#2
0
In SSMS for your first database right click on the datbaase name then "Script Database as" > "CREATE To" then choose your output location and run your script.
在第一个数据库的SSMS中右键单击datbaase名称,然后单击“Script Database as”>“CREATE To”,然后选择输出位置并运行脚本。
Edit:
Note you will need to amend the script to specify the new database name, replacing the existing one in the generated script (courtesy of Oded comment).
请注意,您需要修改脚本以指定新的数据库名称,替换生成的脚本中的现有名称(由Oded评论提供)。
#3
0
In the SQL server Management Studio you can right click the database -> tasks -> export data. Then follow the wizard..
在SQL Server Management Studio中,您可以右键单击数据库 - >任务 - >导出数据。然后按照向导..