<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>TSQL Recursive - MSSQL Query</title>
	<atom:link href="https://mssqlquery.com/tag/tsql-recursive/feed" rel="self" type="application/rss+xml" />
	<link>https://mssqlquery.com</link>
	<description>MSSQL and TSQL Programming and TSQL Examples</description>
	<lastBuildDate>Fri, 07 Apr 2023 19:08:15 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.3.1</generator>

<image>
	<url>https://mssqlquery.com/wp-content/uploads/2023/06/cropped-mssql-query-icon-32x32.png</url>
	<title>TSQL Recursive - MSSQL Query</title>
	<link>https://mssqlquery.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Procedure for Recursive Calculation of Factorial Calculation in SQL Server</title>
		<link>https://mssqlquery.com/procedure-for-recursive-calculation-of-factorial-calculation-in-sql-server</link>
		
		<dc:creator><![CDATA[Yavuz Selim Kart]]></dc:creator>
		<pubDate>Sat, 26 Feb 2022 13:14:20 +0000</pubDate>
				<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Factorial Calculation in SQL Server]]></category>
		<category><![CDATA[Procedure for Recursive Calculation]]></category>
		<category><![CDATA[TSQL Recursive]]></category>
		<guid isPermaLink="false">https://mssqlquery.com/?p=706</guid>

					<description><![CDATA[<p>Hello everyone, In this section, I will make an example of a procedure that recursively calculates factorial in SQL Server. First, let&#8217;s talk about what factorial is. The product of numbers starting from 1 up to a certain counting number is called the factorial of that number. For example, the&#46;&#46;&#46;</p>
<p>The post <a href="https://mssqlquery.com/procedure-for-recursive-calculation-of-factorial-calculation-in-sql-server">Procedure for Recursive Calculation of Factorial Calculation in SQL Server</a> first appeared on <a href="https://mssqlquery.com">MSSQL Query</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>Hello everyone,</p>
<p>In this section, I will make an example of a procedure that recursively calculates factorial in SQL Server.</p>
<p>First, let&#8217;s talk about what factorial is.</p>
<p>The product of numbers starting from 1 up to a certain counting number is called the factorial of that number.</p>
<p>For example, the factorial of 5 (denoted by 5!): 120 = 5 * 4 * 3 * 2 * 1.</p>
<p><strong>What is recursive?</strong></p>
<p>If a structure has the ability to refer to itself, such structures are called recursive structures.</p>
<p>Now let&#8217;s move on to the code example.</p>
<pre class="line-numbers"><code class="language-sql">CREATE PROCEDURE CalculateFactorial
(
    @Number INTEGER,
    @Result INTEGER OUTPUT
)
AS
DECLARE @Input INTEGER;
DECLARE @Output INTEGER;
IF @Number != 1
BEGIN
    SELECT @Input = @Number - 1;
    EXEC FaktoriyelHesapla @Input, @Output OUTPUT;
    SELECT @Result = @Number * @Output;
END;
ELSE
BEGIN
    SELECT @Result = 1;
END;
RETURN; 

--Çalıştırılması 

DECLARE @Result INTEGER;
EXEC CalculateFactorial @Number = 5,              -- integer 
                       @Result = @Result OUTPUT; -- integer 
PRINT @Result;</code></pre>
<p>When you create and run the above procedure, you will see a result similar to the one below.</p>
<p><img decoding="async" fetchpriority="high" class="alignnone wp-image-709 size-full" src="https://mssqlquery.com/wp-content/uploads/2022/02/procedure-for-recursive-calculation-of-factorial-calculation-in-sql-server-1.jpg" alt="Procedure for Recursive Calculation of Factorial Calculation in SQL Server" width="700" height="446" srcset="https://mssqlquery.com/wp-content/uploads/2022/02/procedure-for-recursive-calculation-of-factorial-calculation-in-sql-server-1.jpg 700w, https://mssqlquery.com/wp-content/uploads/2022/02/procedure-for-recursive-calculation-of-factorial-calculation-in-sql-server-1-300x191.jpg 300w" sizes="(max-width: 700px) 100vw, 700px" /></p>
<p>As can be seen, we have calculated the factorial recursively.</p>
<p>Good luck to everyone in business and life.</p>
<div class='epvc-post-count'><span class='epvc-eye'></span>  <span class="epvc-count"> 162</span><span class='epvc-label'> Views</span></div><p>The post <a href="https://mssqlquery.com/procedure-for-recursive-calculation-of-factorial-calculation-in-sql-server">Procedure for Recursive Calculation of Factorial Calculation in SQL Server</a> first appeared on <a href="https://mssqlquery.com">MSSQL Query</a>.</p>]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
