SQL点符号 [英] SQL dot notation

查看:35
本文介绍了SQL点符号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

谁能向我解释一下 SQL Server 如何使用点表示法来识别
一张桌子的位置?一直以为位置是Database.dbo.Table
但我看到的代码用其他东西代替了 dbo,例如:
DBName.something.Table有人可以解释一下吗?

Can someone please explain to me how SQL Server uses dot notation to identify
the location of a table? I always thought that the location is Database.dbo.Table
But I see code that has something else in place of dbo, something like:
DBName.something.Table Can someone please explain this?

推荐答案

这是一个数据库架构.表的完整三部分名称是:

This is a database schema. Full three-part name of a table is:

databasename.schemaname.tablename

对于用户的默认架构,您也可以省略架构名称:

For a default schema of the user, you can also omit the schema name:

databasename..tablename

您还可以指定链接服务器名称:

You can also specify a linked server name:

servername.databasename.schemaname.tablename

您可以在 MSDN:

服务器、数据库和所有者名称被称为对象名称的限定符.引用对象时,不必指定服务器、数据库和所有者.可以通过用句点标记它们的位置来省略限定符.对象名称的有效形式包括:

The server, database, and owner names are known as the qualifiers of the object name. When you refer to an object, you do not have to specify the server, database, and owner. The qualifiers can be omitted by marking their positions with a period. The valid forms of object names include the following:

server_name.database_name.schema_name.object_name

server_name.database_name.schema_name.object_name

server_name.database_name..object_name

server_name.database_name..object_name

server_name..schema_name.object_name

server_name..schema_name.object_name

服务器名称...对象名称

server_name...object_name

database_name.schema_name.object_name

database_name.schema_name.object_name

database_name..object_name

database_name..object_name

schema_name.object_name

schema_name.object_name

对象名称

指定所有四个部分的对象名称称为完全限定名称.在 Microsoft SQL Server 中创建的每个对象都必须具有唯一的完全限定名称.例如,同一个数据库中可以有两个名为 xyz 的表,如果它们的所有者不同.

An object name that specifies all four parts is known as a fully qualified name. Each object that is created in Microsoft SQL Server must have a unique, fully qualified name. For example, there can be two tables named xyz in the same database if they have different owners.

大多数对象引用使用由三部分组成的名称.默认 server_name 是本地服务器.默认的 database_name 是连接的当前数据库.默认 schema_name 是提交语句的用户的默认架构.除非另外配置,否则新用户的默认架构是 dbo 架构.

Most object references use three-part names. The default server_name is the local server. The default database_name is the current database of the connection. The default schema_name is the default schema of the user submitting the statement. Unless otherwise configured, the default schema of new users is the dbo schema.

这篇关于SQL点符号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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