如何生成脚本以使用 SQL Server Management Studio [架构和数据] 重新创建表? [英] How to generate scripts to recreate table using SQL Server Management Studio [Schema and data]?
问题描述
我在本地 SQL 服务器数据库中有一个表.我想在托管数据库中重新创建此表.
I have a table in a local SQL server database. I want to recreate this table in a hosted database.
我想要做的是有一个脚本,当针对托管数据库运行时,该表会使用所有数据等重新创建.
What I want to do is to have a script that when run against the hosted database, this table is recreated with all the data, etc.
如何使用 SQL Server Management Studio 创建此脚本?谢谢.
How do I create this script using SQL Server Management Studio? Thanks.
推荐答案
1- 打开 SQL server Management Studio.
1- Open SQL server Management Studio.
2- 右键单击包含所需表的数据库.
2- Right click on the DB that contains your desired table.
3- 选择任务 => 生成脚本...".
3- Select "Tasks => Generate Scripts...".
4- 按照向导,选择要为其生成脚本的对象(表、视图、存储过程等...).
4- Follow on the wizard, and choose the objects that you want to generate scripts for (Tables, Views, Stored Procedures, etc... ).
5- 在下一步中,单击高级",对于标记为要编写脚本的数据类型"的节点,选择架构和数据".
5- From the next step, click on "Advanced", and for the node that is labeled "Types of data to script" choose "Schema and data".
6- 保存您的脚本并微笑 :)
6- Save your script and smile :)
这篇关于如何生成脚本以使用 SQL Server Management Studio [架构和数据] 重新创建表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!