how to convert a numeric value into eng.words e.g 10 to ten in sql statement?
views:
161answers:
3
+2
A:
DECLARE @INPUT int
SET @input = 1
SELECT CASE WHEN @INPUT = 1 THEN 'One'
WHEN @INPUT = 2 THEN 'Two'
etc...
WHEN @INPUT = 10 THEN 'Ten'
END AS [Value]
Rafe Lavelle
2009-10-07 06:53:53
A:
If it is a large number, then you are best off creating a lookup table to do this for you. For a small number Ralph's solution is more than adequate.
Another option is to use an algorithm in another tier to do this for you- like the one discussed here. You could even write a stored procedure in C# if you wanted to.
RichardOD
2009-10-07 06:55:28
Yep, I am assuming, simply from the phrasing of the question, a very small list of numbers
Rafe Lavelle
2009-10-07 07:01:06