在sql server中建立索引 [英] indexing in sql server

查看:62
本文介绍了在sql server中建立索引的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在sql server中的表上创建索引时。

将生成唯一ID。如何查看生成的唯一ID



如果我在具有重复值的列上创建聚簇索引,sql server将通过附加其他一些数据使其唯一。如何获得该信息?

When I create an index on a table in sql server.
A unique id will be generated. How to view the unique id generated

If I create clustered index on a column having duplicate values, sql server will make it unique by appending some other data. How to get that inforamtion ?

推荐答案

如果我理解你,你想获得最后插入值的ID。请参阅: @@ IDENTITY [ ^ ]。

类似函数:SCOPE_IDENTITY [ ^ ]和 IDENT_CURRENT [ ^ ]。
If i understand you well, you want to get ID for last inserted value. See: @@IDENTITY[^].
Similar functions: SCOPE_IDENTITY[^], and IDENT_CURRENT[^].


这篇关于在sql server中建立索引的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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