存储过程视图 [英] Stored Procedures Vs. Views

查看:131
本文介绍了存储过程视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用了两个,但我不清楚是什么时候我应该更喜欢一个。我的意思是我知道存储过程可以接受参数...但真的,我们仍然可以执行相同的事情使用视图太对不对?

I have used both but what I am not clear is when I should prefer one over the other. I mean I know stored procedure can take in parameters...but really we can still perform the same thing using Views too right ?

因此,考虑到绩效和其他方面,何时以及为什么我应该偏爱另一个?

So considering performance and other aspects when and why should I prefer one over the other ?

推荐答案

好吧,我会使用存储过程来更好地封装代码和控制权限。

Well, I'd use stored proc for encapsulation of code and control permissions better.

视图不是真正的封装:展开。如果你很快开始加入视图,你会有一些可怕的查询。是的,他们可以被加入,但他们不应该

A view is not really encapsulation: it's a macro that expands. If you start joining views pretty soon you'll have some horrendous queries. Yes they can be JOINed but they shouldn't..

说,视图是一个工具, )like stored procs。

Saying that, views are a tool that have their place (indexed views for example) like stored procs.

这篇关于存储过程视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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