Tuesday, April 20, 2010

How to Convert SQL to Money Value

This query is an example of how you can convert your SQL statement to a dollar format. You can first cast your number or decimal column to a money type, and then you can cast it to varchar so you can add it to a dollar sign. If you are going to do calculations to it, you should do the calculations in your code and then add the dollar sign.


select '$'+convert(varchar(256),CAST(project_planned_cost AS money),1) as projectplannedcost,project_planned_finish_date,project_planned_start_date,project_blueprint_name,project_component_name,project_description from tdm_fct_prjct
where project_component_id=?
order by project_component_name

0 comments: