索引名称在数据库中必须是唯一的吗? [英] name of index need to be unique in database?

查看:86
本文介绍了索引名称在数据库中必须是唯一的吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

索引名称在整个 sql server 数据库中必须是唯一的,还是只针对该表?

例如,我应该将索引命名为:IX_OrderLoadCarrierDelivery_OrderLoadID

对于OrderLoadCarrierDelivery 表的OrderLoadID 列.或者我应该把它命名为 IX_OrderLoadID

谢谢!

解决方案

对于创建它们的表或视图,它们必须是唯一的.

这是一个 关于 msdn 的参考,详细说明了这一点.>

自由贸易协定:

<块引用>

索引名称

是索引的名称.索引名称在一个目录中必须唯一表或视图,但不必是在数据库中是唯一的.索引名称必须遵循标识符规则.

我相信约定是

IX_FieldName

Do index names have to be unique accross the entire sql server database, or just for that table?

For example, should I name my index: IX_OrderLoadCarrierDelivery_OrderLoadID

for the OrderLoadID column of the OrderLoadCarrierDelivery table. Or should I just name it IX_OrderLoadID

Thanks!

解决方案

They have to be unique for the table or view they were created for.

Here is a reference on msdn that details this.

FTA:

index_name

Is the name of the index. Index names must be unique within a table or view but do not have to be unique within a database. Index names must follow the rules of identifiers.

I believe the convention is

IX_FieldName

这篇关于索引名称在数据库中必须是唯一的吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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