Results 1 to 15 of 18

030106, 03:37 #1Registered User
 Join Date
 Feb 2006
 Posts
 42
Unanswered: how to convert numbers into words
hi could u help me in suggesting how to convert number given in Rs or in $ to words as normal we spell.. ther's is no limit it can be billions or millions.. thanks in advance..

chakri

030106, 06:11 #2Registered User
 Join Date
 Nov 2002
 Posts
 272
Here:
http://www.planetsourcecode.com/vb...d=502&lngWId=5
is a downloadable set of useful functions, including NumberToWords(),which sounds like what you want.

030106, 06:31 #3Registered User
 Join Date
 Feb 2006
 Posts
 42
thank q verymuch.. it helpes me a lot

chakri

030206, 02:26 #4Registered User
 Join Date
 Feb 2006
 Posts
 42
could u help me a procedure for words of numbers along with paise in dollars with cents and as well as for Rs and paise also.. In the one u gave me url i dint find for my requirement only for numbers it is there..thnks for ur help
chakri

030206, 09:28 #5World Class Flame Warrior
 Join Date
 Jun 2003
 Location
 Ohio
 Posts
 12,595
Provided Answers: 1Examples, please?
If it's not practically useful, then it's practically useless.
blindman
www.chess.com: "sqlblindman"
www.LobsterShot.blogspot.com

030206, 09:34 #6Registered User
 Join Date
 Feb 2006
 Posts
 42
if i give 11034.20 $ output: eleven thousand three hundred and thirty four dollars twenty cents.
if 11034.20 Rs output : eleven thousand three hundred and thirty four rupees twenty paise. there is no limit for the input ofcourse upto octillion.

030206, 12:27 #7L O S T in Reality
 Join Date
 Nov 2005
 Location
 San Francisco, CA
 Posts
 506
Originally Posted by chakri
Well,I think u want it in sql server...hmmm
Joydeep

030206, 12:35 #8World Class Flame Warrior
 Join Date
 Jun 2003
 Location
 Ohio
 Posts
 12,595
Provided Answers: 1You should be able to modify this code to add the text "dollars", "cents", "rupees", etc:
http://www.novicksoftware.com/UDFofW...um_ToWords.htmIf it's not practically useful, then it's practically useless.
blindman
www.chess.com: "sqlblindman"
www.LobsterShot.blogspot.com

030306, 02:19 #9Registered User
 Join Date
 Feb 2006
 Posts
 42
I tried this is for dollars, this could be changed for Rs also where in place of 4,7,10,13 and 16 if
replaced by 3,6,9, and 15 .. and atlast instead of 3,6,9,12 and 15 replace with 3,5,8,11.. its not
displaying could u modify this dollars code to Rs code and i am trying to get for cents and paise..
please help me in doing that also..thanks in adv.,
Code:DECLARE @i int, @temp char(1), @s VARCHAR(20), @result VARCHAR(255),@N BIGINT /*INPUT */ SELECT @s=convert(varchar(20), @n) SELECT @i=LEN(@s) SELECT @result='' WHILE (@i>0) BEGIN SELECT @temp=(SUBSTRING(@s,@i,1)) IF ((LEN(@s)@i) % 3)=1 IF @temp='1' SELECT @result=CASE (SUBSTRING(@s,@i+1,1)) WHEN '0' THEN 'ten' WHEN '1' THEN 'eleven' WHEN '2' THEN 'twelve' WHEN '3' THEN 'thirteen' WHEN '4' THEN 'fourteen' WHEN '5' THEN 'fifteen' WHEN '6' THEN 'sixteen' WHEN '7' THEN 'seventeen' WHEN '8' THEN 'eighteen' WHEN '9' THEN 'nineteen' END+' '+CASE WHEN ((LEN(@s)@i)=4) THEN 'thousand ' WHEN ((LEN(@s)@i)=7) THEN 'million ' WHEN ((LEN(@s)@i)=10) THEN 'billion ' WHEN ((LEN(@s)@i)=13) THEN 'trillion ' WHEN ((LEN(@s)@i)=16) THEN 'quadrillion ' ELSE '' END+@result ELSE BEGIN SELECT @result=CASE (SUBSTRING(@s,@i+1,1)) WHEN '0' THEN '' WHEN '1' THEN 'one' WHEN '2' THEN 'two' WHEN '3' THEN 'three' WHEN '4' THEN 'four' WHEN '5' THEN 'five' WHEN '6' THEN 'six' WHEN '7' THEN 'seven' WHEN '8' THEN 'eight' WHEN '9' THEN 'nine' END+' '+ CASE WHEN ((LEN(@s)@i)=4) THEN 'thousand ' WHEN ((LEN(@s)@i)=7) THEN 'million ' WHEN ((LEN(@s)@i)=10) THEN 'billion ' WHEN ((LEN(@s)@i)=13) THEN 'trillion ' WHEN ((LEN(@s)@i)=16) THEN 'quadrillion ' ELSE '' END+@result SELECT @result=CASE @temp WHEN '0' THEN '' WHEN '1' THEN 'ten' WHEN '2' THEN 'twenty' WHEN '3' THEN 'thirty' WHEN '4' THEN 'fourty' WHEN '5' THEN 'fifty' WHEN '6' THEN 'sixty' WHEN '7' THEN 'seventy' WHEN '8' THEN 'eighty' WHEN '9' THEN 'ninety' END+' '+@result END IF (((LEN(@s)@i) % 3)=2) OR (((LEN(@s)@i) % 3)=0) AND (@i=1) BEGIN SELECT @result=CASE @temp WHEN '0' THEN '' WHEN '1' THEN 'one' WHEN '2' THEN 'two' WHEN '3' THEN 'three' WHEN '4' THEN 'four' WHEN '5' THEN 'five' WHEN '6' THEN 'six' WHEN '7' THEN 'seven' WHEN '8' THEN 'eight' WHEN '9' THEN 'nine' END +' '+CASE WHEN (@s='0') THEN 'zero' WHEN (@temp<>'0')AND( ((LEN(@s)@i) % 3)=2) THEN 'hundred ' ELSE '' END + CASE WHEN ((LEN(@s)@i)=3) THEN 'thousand ' WHEN ((LEN(@s)@i)=6) THEN 'million ' WHEN ((LEN(@s)@i)=9) THEN 'billion ' WHEN ((LEN(@s)@i)=12) THEN 'trillion ' WHEN ((LEN(@s)@i)=15) THEN 'quadrillion ' ELSE '' END+ @result END SELECT @i=@i1 END select REPLACE(@result,' ',' ')+' dollars'
chakri

022608, 04:47 #10Registered User
 Join Date
 Feb 2008
 Posts
 11
HI ,
I found this post while i was searching for how to convert rupees into words.
I also have the same function but not able convert it into rupees format .Did u find any solution for this , if u hv then pls help me out .
Thanks

022608, 04:53 #11www.gvee.co.uk
 Join Date
 Jan 2007
 Location
 UK
 Posts
 11,445
Provided Answers: 12I found a good example here: http://www.users.drew.edu/skass/sql/nameMoney.sql.txt

022608, 05:39 #12Registered User
 Join Date
 Feb 2008
 Posts
 11
Thnks for the example . But it is for the billion and million and i want it in indian format i.e Rupees , which has differnt logic .In US format ,they count after 3 digits like 100,000,000 while in indian format we count it as 10,00,00,000 i.e 2 digits and in the end three digits which is 100's place . Can u help me out coz i m not able to convert the US format in indian rupees format
Thanks

022608, 06:45 #13Registered User
 Join Date
 Feb 2008
 Posts
 11
tHANK U VERY MUCH .I replaced the values with rupees logic and got the desired output .Really thanks

022608, 08:17 #14www.gvee.co.uk
 Join Date
 Jan 2007
 Location
 UK
 Posts
 11,445
Provided Answers: 12

022608, 19:06 #15Registered User
 Join Date
 Apr 2007
 Posts
 183
What about lakhs?