{"id":2599,"date":"2013-04-07T04:54:56","date_gmt":"2013-04-07T04:54:56","guid":{"rendered":"http:\/\/enjoyasp.net\/?p=2599"},"modified":"2013-04-07T04:54:56","modified_gmt":"2013-04-07T04:54:56","slug":"%e5%ad%98%e5%82%a8%e8%bf%87%e7%a8%8b%e9%97%b4%e4%bc%a0%e5%80%bc","status":"publish","type":"post","link":"https:\/\/enjoyasp.net\/index.php\/2013\/04\/07\/%e5%ad%98%e5%82%a8%e8%bf%87%e7%a8%8b%e9%97%b4%e4%bc%a0%e5%80%bc\/","title":{"rendered":"\u5b58\u50a8\u8fc7\u7a0b\u95f4\u4f20\u503c"},"content":{"rendered":"<pre class=\"brush:sql;first-line:1;pad-line-numbers:true;highlight:null;collapse:false;\">\r\n-- First Stored Procedure\r\nCREATE PROCEDURE SquareSP\r\n@MyFirstParam INT\r\nAS\r\nDECLARE @MyFirstParamSquare INT\r\nSELECT @MyFirstParamSquare = @MyFirstParam*@MyFirstParam\r\n-- Additional Code\r\nRETURN (@MyFirstParamSquare)\r\nGO\r\n\r\nNow let us create second Stored Procedure which gives us area of the circle.\r\n\r\n-- Second Stored Procedure\r\nCREATE PROCEDURE FindArea\r\n@SquaredParam INT\r\nAS\r\nDECLARE @AreaofCircle FLOAT\r\nSELECT @AreaofCircle = @SquaredParam * PI()\r\nRETURN (@AreaofCircle)\r\nGO\r\n\r\nYou can clearly see that we need to pass the result of the first stored procedure (SquareSP) to second stored procedure (FindArea). We can do that by using following method:\r\n\r\n-- Pass One Stored Procedure&#39;s Result as Another Stored Procedure&#39;s Parameter\r\nDECLARE @ParamtoPass INT, @CircleArea FLOAT\r\n-- First SP\r\nEXEC @ParamtoPass = SquareSP 5\r\n-- Second SP\r\nEXEC @CircleArea = FindArea @ParamtoPass\r\nSELECT @CircleArea FinalArea\r\nGO\r\n\r\nYou can see that it is extremely simple to pass the result of the first stored procedure to second procedure.\r\n\r\nYou can clean up the code by running the following code.\r\n\r\n-- Clean up\r\nDROP PROCEDURE SquareSP\r\nDROP PROCEDURE FindArea\r\nGO\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>&#8212; First Stored Procedure CREATE PROCEDURE SquareSP @My [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[36],"tags":[],"class_list":["post-2599","post","type-post","status-publish","format-standard","hentry","category-sql-server"],"blocksy_meta":[],"_links":{"self":[{"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/posts\/2599","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/comments?post=2599"}],"version-history":[{"count":0,"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/posts\/2599\/revisions"}],"wp:attachment":[{"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/media?parent=2599"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/categories?post=2599"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/tags?post=2599"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}