存储过程和函数 [英] Stored procedures and functions
问题描述
存储过程和函数有什么区别.
What are the differences between stored procedures and functions.
只要有更多的输入、输出参数,我就会去存储过程.如果只有一个,我会去寻找功能.
Whenever there are more input, output parameters i go for stored procedure. If it is only one i will go for functions.
除此之外,如果我使用更多的存储过程会不会有任何性能问题?我很担心,因为我的项目中有近 50 个存储过程.
Besides that, is there any performance issue if i use more stored procedures? I am worried as i have close to 50 stored procedures in my project.
它们在概念上有何不同.
How they differ conceptually.
提前致谢!
-
当我在存储过程和函数中执行计算时,我发现在存储过程中需要 0.15 秒,而在函数中需要 0.45 秒.
When i executed a calculation in stored procedure and in functions, i have found that in stored procedures it is taking 0.15 sec, while in function it takes 0.45sec.
令人惊讶的是,函数比存储过程花费的时间更多.可能函数是值得的,因为它的可重用性.
Surprisingly functions are taking more time than stored procedures. May be functions are worth for its reusability.
内联函数比存储过程执行得更快.我认为,这是因为多选函数不能使用统计数据,这会减慢它们的速度,但内联表值函数可以使用统计数据.
Inline functions executes quicker than strored procedures. I think, this is because multi-select functions can't use statastics, which slows them down, but inline table-value functions can use statistics.
推荐答案
SQL Server 中存储过程和函数的区别...
Difference between stored procedure and functions in SQL Server ...
http://www.dotnetspider.com/resources/18920-Difference-between-Stored-Procedure-Functions.aspx
存储过程和用户定义函数的区别[UDF]
Difference between Stored procedures and User Defined functions[UDF]
http://www.go4expert.com/forums/showthread.php?t=329
存储过程与函数
http://searchsqlserver.techtarget.com/tip/Stored-procedures-vs 函数
存储过程和函数在...中的区别是什么
What are the differences between stored procedure and functions in ...
http://www.allinterview.com/showanswers/28431.html
存储过程和函数的区别
http://www.sqlservercentral.com/Forums/Topic416974-8-1.aspx
这篇关于存储过程和函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!