SQL 2012,在SP与SP的调用中执行代码 [英] SQL 2012 , Execute Code in SP vs SP's calling

查看:95
本文介绍了SQL 2012,在SP与SP的调用中执行代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨专家, 



我有3个SP,我需要执行一个其他 



SP_1,SP_2,SP_3 



我需要了解性能差异如果SP的代码是用单个SP或如果SP被调用。



- 整个代码用单个SP写入
Alter Proc SP_1 

As 

开始 

SP-1代码...



SP_2代码...



< span style ="white-space:pre"> SP_3代码




结束



- 从第一个SP调用2个SP 

Alter Proc SP_1 

As 

开始&nbs p;

SP-1代码...



执行SP_2(从SP_1致电SP_2)

执行SP_3(从SP_2拨打SP_3)



$
结束

Hi Experts , 

I have 3 SP , which I need to Execute one After Other 

SP_1 , SP_2 ,SP_3 

I need to Understand the Performance difference if code of SP's are written in Single SP or if SP's are called.

-- Entire Code is Written in Single SP
Alter Proc SP_1 
As 
Begin 
Code of SP-1 ...

Code of SP_2...

Code of SP_3


END

-- 2 SP's are called from 1st SP 
Alter Proc SP_1 
As 
Begin 
Code of SP-1 ...

Exec SP_2 (Call SP_2 from SP_1)
Exec SP_3 (Call SP_3 from SP_2)


END

哪个会更好,为什么,有什么帮助?

Which will Perform better and Why , any help ?

推荐答案


我需要了解效果差异如果SP的代码是用单个SP写的,或者是SP的代码被调用。

I need to Understand the Performance difference if code of SP's are written in Single SP or if SP's are called.




没有;为什么要有一些?


There is none; why should there be some?


这篇关于SQL 2012,在SP与SP的调用中执行代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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