Click on the banner to learn about and purchase my database training on Azure

SQL Server – How to write a full number in Portuguese and English using T-SQL function

Views: 235
Reading Time: 8 minutes

Hey guys!
On 07/04 I saw a question in a Whatsapp group about the possibility of SQL Server has a native function to write numbers in full, which doesn't exist.

I started looking for some T-SQL functions on the internet that do this and I just managed to find a function that can meet this objective and I would like to share with you an altered version of this function (original function link) I've improved the code and made some fixes, as well as creating an English version of this function as well.

Portuguese version:

Using this function, it will be easy to return numbers in the form of an extended, with or without a coin. See the code below and some examples to understand how to use this function in your daily life:

Examples of use - With currency:

Result:

Examples of use - WITHOUT currency:

Result:

English version

If you need to return the number in full in English, you can also use this adapted version of the script above.

Examples of use - With currency:

Result:

Examples of use - WITHOUT currency:

Result:

And that's it folks!
I hope you liked this tip there and that it is useful in your projects.

A big hug and until next time!