So Excel is your front-end, right? It formats numeric values very well - better than sql server why don't use simply return the native value and format it in Excel?EDIT:The problem with formatting it in the sql query is that you need to convert the values to character strings. That is slow. It also means you loose the ability to treat the values as numeric values for calculations, ordering, etc. In case you won't be satisfied without doing it
here is one way:select convert(decimal(15, 0), Qty) as qty ,'$' + convert(varchar(15), convert(decimal(12, 2), total)) as total ,'$' + convert(varchar(9), convert(decimal(6, 2), unit)) as unitfrom ( select 100.00000 as qty, 280.000000000 as total, 2.80000 as unit union all select 450.00000 , 225.000000000, 0.50000 union all select 200.00000 , 100.000000000, 0.50000 ) as yourTableoutput:qty total unit--------------------------------------- ------------------------------- -------------------------------100 $280.00 $2.80450 $225.00 $0.50200 $100.00 $0.50
Be One with the OptimizerTG