SDU Tools: Show a number as text in SQL Server

Years ago, it was common to need to print checks (cheques) from computer systems. Fortunately checks have now pretty much disappeared in most countries. One of the challenges with printing a check, was that you needed to convert an amount of money into words. Even though checks are on the wane, it's still important to do that on some contracts, etc.  In our free SDU Tools for developers and DBAs,  we added a function NumberAsText to do just that.

You can see how to execute it in the main image above.

We decided not to assume that it's a monetary value, just a number, so you could easily turn it into a monetary value like this:

The text is returned in lower-case. It's easy to then use UPPER to force it to upper-case:

You could easily add a comma in between the dollars and the cents as well:

You can see it in action here:

We hope you find it useful.

To become an SDU Insider and to get our free tools and eBooks, please just visit here:

http://sdutools.sqldownunder.com

Leave a Reply

Your email address will not be published.