Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 

Convert Numeric Figures into Words

By johncyriac, 2013/05/20

Hi guys
    What about a function that converts a number figure into words.This sample script is to demonstrate the procedural capabilities of SQL Server .
Samples  select fig2words(10) will give --Ten-- ,select fig2words(103) will give --one hundred and three --
    The author uses much under utilized capability of SQL Server the recursive function calls to implement this inherently recursive logic many will raise their eyebrows and will complain about performance issues, dont worry ,no problem at all my warranty is there.
    This function uses a base table named  units_table ,as described  after the script ,pl create this table and populate it with the subsequent statement. Now you can go for the creation of the function, just replace the user name here "john" with your session user name.
    Recursive logic is very clear and author dont want to put even his name as comment in order not to disturb the free flow of the logic

How about including this in standard convert function !!!

Have nice time

Regards John
See Rezvan modifications down the code

Total article views: 408 | Views in the last 30 days: 3
 
Related Articles
FORUM

Function Recursive

Possibility of recursive function

FORUM

Recursive User-Defined Function

I need a recursive function because the table describing the relationships is a many-to-many table a...

ARTICLE

Using Recursion and Date Tables to Simplify Date Logic

Learn to simplify date logic using date tables and recursion in T-SQL with this article from David B...

FORUM

Recursive function

Recursive function in SQL to strip a string from a string between 2 points

FORUM
Tags
t-sql    
 
Contribute

Join the most active online SQL Server Community

SQL knowledge, delivered daily, free:

Email address:  

You make SSC a better place

As a member of SQLServerCentral, you get free access to loads of fresh content: thousands of articles and SQL scripts, a library of free eBooks, a weekly database news roundup, a great Q & A platform… And it’s our huge, buzzing community of SQL Server Professionals that makes it such a success.

Join us!

Steve Jones
Editor, SQLServerCentral.com

Already a member? Jump in:

Email address:   Password:   Remember me: Forgotten your password?
Steve Jones