在SQL Server Management Studio中生成脚本 [英] Generate script in SQL Server Management Studio

查看:376
本文介绍了在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?

如果我右键单击表,然后选择脚本表为>创建到> File ,它会生成一个脚本来创建没有数据的表。我需要的是一个脚本,创建表并添加已经存在于表中的数据或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.

推荐答案

这里你要做什么:


  1. 右键单击数据库)并选择任务 - >生成脚本

  2. 下一步 - >选择所需的表/表(来自选择特定数据库对象)

  3. < - >点击高级 - >数据类型到脚本=模式和数据
  4. 接下来完成

  1. right click the database (not the table) and select tasks --> generate scripts
  2. Next --> select the requested table/tables (from select specific database objects)
  3. next --> click advanced --> types of data to script = schema and data
  4. next and finish

这篇关于在SQL Server Management Studio中生成脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆