SQL Server Central is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
Search:  
 
 

Convert Numeric Figures into Words

By johncyriac, 2004/01/12

Total article views: 172 | Views in the last 30 days: 2

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

By johncyriac, 2004/01/12

Total article views: 172 | Views in the last 30 days: 2
Your response
 
 
Related tags

T-SQL Aids    
 
Already registered?  

Free registration required

To read the rest of this article, and access thousands of other articles, we ask you to register on the site and subscribe to our newsletters.

Register

E-mail address:
Password:
Password (confirm):

  

Subscriptions

We ask you to register on the site and subscribe to our newsletters. Subscribing to our newsletters gets you:

  • ALL of our content (thousands of articles, scripts, and forum postings)
  • A daily newsletter (example)
  • A weekly news round up (example)
  • The opportunity to ask and answer questions in our forums
  • A daily Question of the Day to test and help you increase your knowledge of SQL Server.

We ask that you give the newsletter a try for a week. Over 200,000 SQL Server Professionals a day find it entertaining and useful. If not, you are welcome to unsubscribe at anytime.

Steve Jones
Editor, SQLServerCentral.com