数据库和模式之间的差异 [英] Difference between database and schema

查看:247
本文介绍了数据库和模式之间的差异的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

SQL Server中的数据库和架构之间有什么区别?两个都是表和数据的容器。

What's the difference between a Database and a Schema in SQL Server? Both are the containers of tables and data.

如果一个模式被删除,那么该模式中包含的所有表也会自动删除,或者当数据库已删除?

If a Schema is deleted, then are all the tables contained in that schema also deleted automatically or are they deleted when the Database is deleted?

推荐答案

数据库是主容器,它包含数据和日志文件以及其中的所有模式。你总是备份一个数据库,它是一个独立的单元。

A database is the main container, it contains the data and log files, and all the schemas within it. You always back up a database, it is a discrete unit on its own.

模式就像数据库中的文件夹,主要用于将逻辑对象组合在一起

Schemas are like folders within a database, and are mainly used to group logical objects together, which leads to ease of setting permissions by schema.

drop schema test1




Msg 3729,Level 16,State 1,行1

无法删除模式'test1',因为它正在被对象'copyme'引用。

Msg 3729, Level 16, State 1, Line 1
Cannot drop schema 'test1' because it is being referenced by object 'copyme'.

在使用模式时无法删除模式。您必须先从模式中删除所有对象。

You cannot drop a schema when it is in use. You have to first remove all objects from the schema.

相关阅读:


  1. SQL Server模式有什么好处?

  2. MSDN:用户模式分离

  1. What good are SQL Server schemas?
  2. MSDN: User-Schema Separation

这篇关于数据库和模式之间的差异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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