MS SQL 2008

编程入门 行业动态 更新时间:2024-10-26 03:28:48
本文介绍了MS SQL 2008 - 创建没有数据的数据库副本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

在MS SQL Server 2008 R2中,如何根据旧数据库的模式创建新数据库,但不复制任何数据?我正在使用SQL Server管理工作室。

In MS SQL Server 2008 R2, how do I create a new database based on the schema of the old one, but without copying any of the data along with it? I am using SQL Server management studio.

推荐答案

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

Right click the Database and select Tasks -> Generate Scripts.

然后,您可以选择所需的所有对象或仅选择某些对象。

You can you then select all the objects you require or only certain objects.

您应该看一些脚本选项:

There are some Script Options that you should look at:

  • 脚本USE DATABASE - 如果要创建具有不同名称的新数据库,则应将其设置为false。
  • 索引&触发器不是默认脚本
  • 登录&对象级权限不作为默认脚本编写
  • 为从属对象生成脚本 - 默认情况下设置为false,但您可能希望将其更改为true以确保所有对象都已编写脚本。 / li>
  • Script USE DATABASE - You should set this to false if you are creating a new database with a different name.
  • Indexes & Triggers are not scripted as default
  • Logins & Object Level Permissions are not scripted as default
  • Generate Script for Dependent objects - this is set to false as default but you may want to change it to true to ensure that all objects are scripted.

您可以将它们创建到新的查询窗口或将它们保存到SQL文件。

You can either create these to a new Query Window or save them to SQL Files.

更多推荐

MS SQL 2008

本文发布于:2023-10-14 12:10:02,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1491028.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:MS   SQL

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!