SQL Clone
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in

Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved scripts in your SSC briefcase from the favorites tab.
Download now (direct download link)

Decimal2Text Measurement Function

By KABay,

This function is based on a script by Tim Dietrich (tim@timdietrich.us) named format_height.sql. His function took what he called a decimal representation of a measurement and formatted it as feet and inches. In reality the input value was just a measurement formatted to look like a decimal number but it was not a true decimal number.

It is more likely that you would find a measurement stored in a DB field as a true decimal value and have to convert and format it as this function does.

For example, a measurement of 5 feet 9 inches, which would be passed in as the decimal 5.75, would be returned as 5'9".

Similarly, a measurement of 4 feet 11 inches, which would be passed in as the decimal 4.90, would be returned as 4'9".

Total article views: 65 | Views in the last 30 days: 1
Related Articles

Manipulating Decimal Format 0000000090.00000

Manipulating Decimal Format 0000000090.00000


Decimal point formating

Decimal point formating in SQL server 2005 Business Inteligence Developement Studio


Select Decimal

Need Decimal() function


Remove Decimals Without Rounding

How do I remove decimals


Formatting SSAS Measures - SQL School Video

ln this SQL School video, learn how you can format the various measures in your SSAS cubes.