哪一个是最好的StoredProcedure或SQL函数 [英] Which one is best StoredProcedure or SQL Function
问题描述
你好哥们........
谢谢大家.......
我正在使用存储过程,在此sp中,我称为另一个sp或另一个函数
这些将返回一个值,我的查询"是sp或函数中哪个更好.
任何人都告诉我一个强大的地区.
就像.........
创建proc testProcedure
如
exec anotherProcedure-返回值--- No1
选择dbo. anotherFunction(@Parameter)-它返回一个值--- No2
因此最好同时使用两者.
谢谢.
sanwar
Hello buddy ........
Thanks of all.......
I am use a stored procedure , in this sp i am call a another sp or another function
these will return a value , My Query is which one better in sp or function.
Any one tell me a powerful region.
As like.........
Create proc testProcedure
as
exec anotherProcedure -- It is return a value ---No1
SELECT dbo. anotherFunction (@Parameter) -- Itis return a value---No2
so which one is better use both of them.
Thanks.
sanwar
推荐答案
功能和存储过程都以编译格式存储在数据库中.
function and stored procedure both are stored in compiled format in database.
SELECT dbo. anotherFunction (@Parameter)
如果您只需要在函数/过程中使用select语句,则上述语句会更好,因为无法执行任何其他语句.
函数可以从任何语句调用.
就像
Above statement is better if u need only select statement in function/procedure,because can not execute any other statement.
function can call from any statement.
like
select anotherFunction(@parameter)
以上声明是可能的
above statement is possible
select anotherstoredprocedure
上面的陈述是不可能的.
above statement is not possible.
这篇关于哪一个是最好的StoredProcedure或SQL函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!