在 SQL Server Management Studio 中生成脚本 [英] Generate script in SQL Server Management Studio
本文介绍了在 SQL Server Management Studio 中生成脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果我在 SQL Server 的数据库中有一个包含数据的表,我如何生成一个脚本来创建表并添加数据?
If I have a table with data in a database in SQL Server, how can I generate a script that will create the table and add the data too?
如果我右键单击表格,然后选择 Script Table As >创建到 >文件
,它生成一个脚本来创建没有数据的表.我需要的是一个脚本来创建表并添加表中已经存在的数据或 2 个单独的脚本,一个创建表,一个添加数据.
If I right click on the table then select Script Table As > Create to > File
, that generates a script to just create the table without the data. What I need is a script that creates the table and adds the data that is already existing in the table or 2 separate scripts, one that creates the table and one that adds the data.
推荐答案
这里是你必须做的:
- 右键单击数据库(而不是表)并选择任务 --> 生成脚本
- 下一步 --> 选择请求的表(从选择特定的数据库对象中)
- 下一步 --> 点击高级 --> 数据类型到脚本 = 模式和数据
- 下一步并完成
这篇关于在 SQL Server Management Studio 中生成脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文