Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Number to Word Conversion

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-03-15 : 09:56:28
Neelesh writes "Hi Developers,

I want to convert Number to word i.e. For eg. 25,000.00 as Twenty Five Thousand Five Hundred.
Does any body know how to convert it ?"

AjarnMark
SQL Slashing Gunting Master

3246 Posts

Posted - 2002-03-15 : 15:31:27
quote:

For eg. 25,000.00 as Twenty Five Thousand Five Hundred



Well, the first challenge is that the number and words in your example don't match. So this could be really tricky.

Assuming that was just a typo... there's no built-in conversion in SQL Server to do this. You would probably be best to use a User-Defined Function (if you are in SQL 2000). Basically, this will involved analyzing each digit of the number one at a time and building the output string. You might search the forums and articles on this site, I think I've seen this topic come up before, or other places on the internet. I suspect that somebody has already created this UDF and it's available out there.

------------------------
GENERAL-ly speaking...

Edited by - AjarnMark on 03/15/2002 15:32:45
Go to Top of Page

Arnold Fribble
Yak-finder General

1961 Posts

Posted - 2002-03-15 : 16:13:57
I wrote one that was just one big expression, but it was a bit of an ugly joke

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=11157

Go to Top of Page
   

- Advertisement -