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)
Thank this author by sharing:
By Adrian Facio,
This function takes a decimal value and returns fractional representation of this value.
Result: 12 1/2
The interesting thing about this code is that it uses a tally table to find the smallest denominator for the decimal part.