This function is used to calculate the actual unit of conversion for power.
This is a most advanced generic function , which suppose to return values for 20 combinations.
Regards,
Vignesh Arulmani
This function is used to calculate the actual unit of conversion for power.
This is a most advanced generic function , which suppose to return values for 20 combinations.
Regards,
Vignesh Arulmani
create function fn_calc_uoc_power(@FromConversionUnit varchar(64),@ToConversionUnit varchar(64),@UnitValue float) returns float as begin --POWER /*=========ACRONYM========== BTU/m - British Thermal Unit per minute FP/m - Foot-Pound per minute HP - Horsepower KW - Kilowatt W - Watt */ declare @returnvalue float select @returnvalue = case when @FromConversionUnit = 'BTU/m' and @ToConversionUnit = 'FP/m' then @UnitValue * 778.1693709678747 when @FromConversionUnit = 'BTU/m' and @ToConversionUnit = 'HP' then @UnitValue * 0.0235808900293295 when @FromConversionUnit = 'BTU/m' and @ToConversionUnit = 'KW' then @UnitValue * 0.0175842666666667 when @FromConversionUnit = 'BTU/m' and @ToConversionUnit = 'W' then @UnitValue * 17.58426666666667 when @FromConversionUnit = 'FP/m' and @ToConversionUnit = 'BTU/m' then @UnitValue * 0.0012850672839464 when @FromConversionUnit = 'FP/m' and @ToConversionUnit = 'HP' then @UnitValue * 3.030303030303029e-5 when @FromConversionUnit = 'FP/m' and @ToConversionUnit = 'KW' then @UnitValue * 2.259696580552333e-5 when @FromConversionUnit = 'FP/m' and @ToConversionUnit = 'W' then @UnitValue * 0.0225969658055233 when @FromConversionUnit = 'HP' and @ToConversionUnit = 'BTU/m' then @UnitValue * 42.40722037023268 when @FromConversionUnit = 'HP' and @ToConversionUnit = 'FP/m' then @UnitValue * 33000.00000000001 when @FromConversionUnit = 'HP' and @ToConversionUnit = 'KW' then @UnitValue * 0.7456998715822702 when @FromConversionUnit = 'HP' and @ToConversionUnit = 'W' then @UnitValue * 745.6998715822702 when @FromConversionUnit = 'KW' and @ToConversionUnit = 'BTU/m' then @UnitValue * 56.86901927480627 when @FromConversionUnit = 'KW' and @ToConversionUnit = 'FP/m' then @UnitValue * 44253.72895663593 when @FromConversionUnit = 'KW' and @ToConversionUnit = 'HP' then @UnitValue * 1.341022089595028 when @FromConversionUnit = 'KW' and @ToConversionUnit = 'W' then @UnitValue * 1000.0 when @FromConversionUnit = 'W' and @ToConversionUnit = 'BTU/m' then @UnitValue * 0.0568690192748063 when @FromConversionUnit = 'W' and @ToConversionUnit = 'FP/m' then @UnitValue * 44.25372895663593 when @FromConversionUnit = 'W' and @ToConversionUnit = 'HP' then @UnitValue * 0.001341022089595 when @FromConversionUnit = 'W' and @ToConversionUnit = 'KW' then @UnitValue * 0.001 when @FromConversionUnit = @ToConversionUnit then @UnitValue * 1.0 end return(@returnvalue) end go --examples select dbo.fn_calc_uoc_power('BTU/m','FP/m',10) select dbo.fn_calc_uoc_power('BTU/m','HP',10) select dbo.fn_calc_uoc_power('BTU/m','KW',10) select dbo.fn_calc_uoc_power('BTU/m','W',10) select dbo.fn_calc_uoc_power('FP/m','BTU/m',10) select dbo.fn_calc_uoc_power('FP/m','HP',10) select dbo.fn_calc_uoc_power('FP/m','KW',10) select dbo.fn_calc_uoc_power('FP/m','W',10) select dbo.fn_calc_uoc_power('HP','BTU/m',10) select dbo.fn_calc_uoc_power('HP','FP/m',10) select dbo.fn_calc_uoc_power('HP','KW',10) select dbo.fn_calc_uoc_power('HP','W',10) select dbo.fn_calc_uoc_power('KW','BTU/m',10) select dbo.fn_calc_uoc_power('KW','FP/m',10) select dbo.fn_calc_uoc_power('KW','HP',10) select dbo.fn_calc_uoc_power('KW','W',10) select dbo.fn_calc_uoc_power('W','BTU/m',10) select dbo.fn_calc_uoc_power('W','FP/m',10) select dbo.fn_calc_uoc_power('W','HP',10) select dbo.fn_calc_uoc_power('W','KW',10)