SQL Server Performance Forum – Threads Archive
calling sub-procsHi, Can someone please tell me… if @tmp<>0 does SQL still have to use resources to create an execution plan (or even execute) usp_myproc3?
Would I benefit from an ELSE statement? Or should this be done a different way? Thanks, Joe —————————————————————————————
CREATE procedure usp_myproc @structure int,
@taxmode int as
declare @tmp int exec @tmp = usp_myproc2 @structure, @bill, @taxmode if @tmp=0
exec @tmp = usp_myproc3 @structure, @bill, @taxmode return @tmp
It seems If this condition @tmp=0 satisfies then only
SQL will use resources to execute usp_myproc3.
I feel there is no need to add any else statement for this.
Ranjit is correct there is no need