<?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>Calculate Body Mass Index in SQL Server - MSSQL Query</title>
	<atom:link href="https://mssqlquery.com/tag/calculate-body-mass-index-in-sql-server/feed" rel="self" type="application/rss+xml" />
	<link>https://mssqlquery.com</link>
	<description>MSSQL and TSQL Programming and TSQL Examples</description>
	<lastBuildDate>Sat, 04 Mar 2023 12:11:12 +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>Calculate Body Mass Index in SQL Server - MSSQL Query</title>
	<link>https://mssqlquery.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Function to Calculate Body Mass Index in SQL Server</title>
		<link>https://mssqlquery.com/function-to-calculate-body-mass-index-in-sql-server</link>
		
		<dc:creator><![CDATA[Yavuz Selim Kart]]></dc:creator>
		<pubDate>Wed, 22 Sep 2021 23:26:53 +0000</pubDate>
				<category><![CDATA[Functions]]></category>
		<category><![CDATA[SQL Server]]></category>
		<category><![CDATA[Calculate Body Mass Index]]></category>
		<category><![CDATA[Calculate Body Mass Index in SQL Server]]></category>
		<category><![CDATA[sql Body Mass Index]]></category>
		<guid isPermaLink="false">https://mssqlquery.com/?p=24</guid>

					<description><![CDATA[<p>Hello to everyone, In this article, I will talk about the function that calculates Body Mass Index in SQL Server. I felt the need to write because I could not find an article or example written on the subject. This is the first post in its field. You may want&#46;&#46;&#46;</p>
<p>The post <a href="https://mssqlquery.com/function-to-calculate-body-mass-index-in-sql-server">Function to Calculate Body Mass Index in SQL Server</a> first appeared on <a href="https://mssqlquery.com">MSSQL Query</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>Hello to everyone,</p>
<p>In this article, I will talk about the function that calculates Body Mass Index in SQL Server. I felt the need to write because I could not find an article or example written on the subject. This is the first post in its field.</p>
<p>You may want to calculate body mass index in SQL Server.</p>
<p>First, let&#8217;s learn what the Body Mass Index.</p>
<p>Body mass index is calculated by dividing body mass by the square of the height in meters.</p>
<p><img decoding="async" fetchpriority="high" class="alignnone wp-image-27 size-full" src="https://mssqlquery.com/wp-content/uploads/2021/09/function-to-calculate-body-mass-index-in-sql-server-1.png" alt="Function to Calculate Body Mass Index in SQL Server" width="700" height="409" srcset="https://mssqlquery.com/wp-content/uploads/2021/09/function-to-calculate-body-mass-index-in-sql-server-1.png 700w, https://mssqlquery.com/wp-content/uploads/2021/09/function-to-calculate-body-mass-index-in-sql-server-1-300x175.png 300w" sizes="(max-width: 700px) 100vw, 700px" /></p>
<p>So the algorithm is pretty simple.</p>
<p>You can easily do this with the help of the function below.</p>
<pre class="line-numbers"><code class="language-sql">CREATE FUNCTION BMI_Calculate
(
    @Weight FLOAT,
    @Height FLOAT
)
RETURNS VARCHAR(20)
BEGIN
    DECLARE @VKI_Result INT = (@Weight / (@Height * @Height));
    DECLARE @Result NVARCHAR(20);
    IF @VKI_Result &lt; 18
        SET @Result = N'Thin';
    ELSE IF (@VKI_Result &gt;= 18 AND @VKI_Result &lt; 25)
        SET @Result = N'Normal';
    ELSE IF (@VKI_Result &gt;= 25 AND @VKI_Result &lt; 30)
        SET @Result = N'Fat';
    ELSE IF (@VKI_Result &gt;= 30 AND @VKI_Result &lt; 35)
        SET @Result = N'Obese';
    ELSE
        SET @Result = N'Seriously Obese';
    RETURN @Result;
END;


--Kullanımı

SELECT dbo.BMI_Calculate(100,1.80) AS Result</code></pre>
<p>&nbsp;</p>
<p>When you run the code you will get the following result.</p>
<p><img decoding="async" class="alignnone wp-image-29 size-full" src="https://mssqlquery.com/wp-content/uploads/2021/09/function-to-calculate-body-mass-index-in-sql-server-2.jpg" alt="Function to Calculate Body Mass Index in SQL Server" width="700" height="556" srcset="https://mssqlquery.com/wp-content/uploads/2021/09/function-to-calculate-body-mass-index-in-sql-server-2.jpg 700w, https://mssqlquery.com/wp-content/uploads/2021/09/function-to-calculate-body-mass-index-in-sql-server-2-300x238.jpg 300w" sizes="(max-width: 700px) 100vw, 700px" /></p>
<p>As you can see, he has calculated the Body Mass Index.</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"> 408</span><span class='epvc-label'> Views</span></div><p>The post <a href="https://mssqlquery.com/function-to-calculate-body-mass-index-in-sql-server">Function to Calculate Body Mass Index in SQL Server</a> first appeared on <a href="https://mssqlquery.com">MSSQL Query</a>.</p>]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
