SQL Server 查看主键 [英] SQL Server View Primary Key

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

问题描述

有没有办法在 sql server 中给视图一个主键.我知道在 oracle 中是可能的.

Is there a way to give a view a primary key in sql server. I know it is possible in oracle.

我不关心更新它的只读视图,但其他人在 ms access 中使用它,所以我希望显示我知道正确的约束.

I am not concerned about updates its a read only view but someone else is using it in ms access so I would like the constraint that I know to be correct to be shown.

推荐答案

是的,您可以创建一个 索引视图,必须有一个主键.请注意,这会将视图数据持久保存到磁盘,这可能是您要查找的内容,也可能不是.

Yes, you can create an indexed view, which must have a primary key. Note, this will persist the view data to disk, which may or may not be what you are looking for.

此外,索引视图的创建也会对性能产生积极和消极的影响.在实施之前,请务必仔细阅读优缺点和局限性.

Also, creation of indexed views can also impact performance, both positively and negatively. Make sure you read up on the pros, cons, and limitations thoroughly before implementing.

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

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