什么时候应该使用存储过程? [英] When should I use stored procedures?

查看:272
本文介绍了什么时候应该使用存储过程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我应该何时使用存储过程,而不是直接在我的应用程序中写入逻辑?我想获得存储过程的好处,但我也不希望我的应用程序逻辑分散在数据库和应用程序。

When should I be using stored procedures instead of just writing the logic directly in my application? I'd like to reap the benefits of stored procedures, but I'd also like to not have my application logic spread out over the database and the application.

有什么经验可以参考吗?

Are there any rules of thumb that you can think of in reference to this?

推荐答案

哇...我要直接对着这里的游泳,说,几乎总是。有一个洗衣名单的原因 - 一些/许多,我相信其他人会争辩。但是我开发了应用程序,无论是否使用存储过程作为数据访问层,并且我的经验是,良好的编写存储过程使编写应用程序变得更容易。然后有良好的记录的性能和安全优势。

Wow... I'm going to swim directly against the current here and say, "almost always". There are a laundry list of reasons - some/many of which I'm sure others would argue. But I've developed apps both with and without the use of stored procs as a data access layer, and it has been my experience that well written stored procedures make it so much easier to write your application. Then there's the well-documented performance and security benefits.

这篇关于什么时候应该使用存储过程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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