my database contains fuel unit prices typically end fractional penny value, such $2.099 per gallon. use built-in format
call in order specify locale. doesn't allow me use currency formatting more 2 decimal places. there way override this? or stuck doing custom formatting based on many many possible locales?
consider example:
declare @fuelprice float = 2.099 select format(@fuelprice, 'g', 'en-us') 'nodollarsign' ,format(@fuelprice, 'c', 'en-us') 'wrongdecimalplaces' ,'$2.099' 'whatiwant'
which outputs:
nodollarsign wrongdecimalplaces whatiwant 2.099 $2.10 $2.099
any chance can this, if reason you're doing display purposes?
declare @fuelprice float = 2.099 select '$' + cast(@fuelprice varchar(10))