Login     Register

        Contact Us     Search

XLeratorDB/engineering Online Documentation

SQL Server function to convert speed to miles per hour


MIHR
 
Updated: 08 September 2010

Use MIHR to convert from feet per hour, feet per minute, feet per second, inches per second, kilometers per hour, knots, miles per hour, miles per minute, miles per second, meters per second, meters per minute, or meters per hour to miles per hour.
Syntax
SELECT [westclintech].[wct].[MIHR] (
  <@Speed, float,>
 ,<@From_scale, nvarchar(4000),>)
Arguments
@Speed
is any real number. @Speed is an expression of type float or of a type that can be implicitly converted to float
@From_scale
is the description of the units for @Speed. @From_scale must be a valid value as specified in speed unit representations@From_scale must be of a data type that is implicitly convertible to varchar.
 
Return Types
float
Remarks
·         The following table is a representation of the conversion of one of the speed units of measure into miles per hour:

feet per hour
0.000189393939
feet per minute
0.0113636364
feet per second
0.681818182
inches per second
0.0568181818
kilometers per hour
0.621371192
knots
1.15077945
miles per hour
1
miles per minute
60
miles per second
3600
meters per second
2.23693629
meters per minute
0.0372822715
meters per hour
0.000621371192


 
·         Conversion of meters includes all the standard prefixes with kilo representing 1,000 and yocto representing 10E-24.
Example
 
SELECT n.UOFM, wct.MIHR (1,n.UOFM)
from (
SELECT 'feet per hour' UNION ALL
SELECT 'feet per minute' UNION ALL
SELECT 'feet per second' UNION ALL
SELECT 'inches per second' UNION ALL
SELECT 'kilometers per hour' UNION ALL
SELECT 'knots' UNION ALL
SELECT 'miles per hour' UNION ALL
SELECT 'miles per minute' UNION ALL
SELECT 'miles per second' UNION ALL
SELECT 'meters per second' UNION ALL
SELECT 'meters per minute' UNION ALL
SELECT 'meters per hour'
      ) n(UOFM)
 
Here is the result set
UOFM               
------------------- ----------------------
feet per hour       0.000189393939
feet per minute     0.0113636364
feet per second     0.681818182
inches per second   0.0568181818
kilometers per hour 0.621371192
knots               1.15077945
miles per hour      1
miles per minute    60
miles per second    3600
meters per second   2.23693629
meters per minute   0.0372822715
meters per hour     0.000621371192
 

(12 row(s) affected)



Copyright 2008-2024 Westclintech LLC         Privacy Policy        Terms of Service