Home » How to display currency symbol in SQL Sever

How to display currency symbol in SQL Sever

How to Display currency symbol in SQL Sever?





Sometimes we are asked to display a currency symbol along with the amount in query result set, It becomes challenge to displaying a currency symbol with amount.

It can be done using FORMAT Function :

FORMAT ( value, format [, culture ] )

The Format() function is used to format numbers, dates, currencies and so on. It accepts three arguments; the number, the format, and an optional “culture” argument.

Using the format function we can get the currency symbol along with amount as given below

DECLARE @amount money = 584020.89;
SELECT @amount as Amount ,
FORMAT(@amount, 'C', 'th-TH') 'Thailand',
FORMAT(@amount, 'C', 'de-DE') 'Germany',
FORMAT(@amount, 'C', 'en-gb') 'British',
FORMAT(@amount, 'C', 'en-us') 'US',
FORMAT(@amount, 'C', 'en-in') 'India',
FORMAT(@amount, 'C', 'fr-FR') 'France',
FORMAT(@amount, 'C', 'zh-cn') 'China'

 

Recommened Posts..

SQL Server FORMAT Function()



Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.