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..
9,739 total views, 1 views today