"If at first you don't succeed; call it version 1.0" :-Unknown

Pages

Monday, April 8, 2013

Passing store procedure result to another store procedure as parameter

Passing store procedure result to another store procedure as parameter

-- First Stored ProcedureCREATE PROCEDURE SquareSP@MyFirstParam INT
AS
DECLARE 
@MyFirstParamSquare INT
SELECT 
@MyFirstParamSquare @MyFirstParam*@MyFirstParam-- Additional CodeRETURN (@MyFirstParamSquare)GO


-- Second Stored ProcedureCREATE PROCEDURE FindArea@SquaredParam INT
AS
DECLARE 
@AreaofCircle FLOAT
SELECT 
@AreaofCircle @SquaredParam PI()RETURN (@AreaofCircle)GO

-- Pass One Stored Procedure's Result as Another Stored Procedure's ParameterDECLARE @ParamtoPass INT@CircleArea FLOAT-- First SPEXEC @ParamtoPass SquareSP 5-- Second SPEXEC @CircleArea FindArea @ParamtoPassSELECT @CircleArea FinalArea
GO


Countersy :: http://blog.sqlauthority.com/2013/04/07/sql-server-pass-one-stored-procedures-result-as-another-stored-procedures-parameter/


If u had any trouble just ask, Happy to help u :) Stay Tune... Have a nice day... 'N happy Coding :)

No comments: