August 20, 2010

Convert VarChar to Currency in SQL Server

To convert a varchar to currency, the recommended practice is to do the formatting in the front end.

However if that option is not available to you, you can use the following T-SQL code to do the formatting. In the code shown below, we are converting varchar into US Dollar currency.

DECLARE @t TABLE(amount decimal(12,2))
SELECT 27450 union all
SELECT 2841.2 union all
SELECT 8786723.62 union all

SELECT amount,'$'+ CONVERT(varchar(100),
CAST(amount as money),1) as converted_amount

Note : The value must be converted to money datatype before the formatting



Did you like this post?
kick it on
subscribe via rss subscribe via e-mail
print this post follow me on twitter

About The Author

Madhivanan,an MSc computer Science graduate from Chennai-India, works as a works as a Lead Subject Matter Expert at a company that simplifies BIG data. He started his career as a developer working with Visual Basic 6.0, SQL Server 2000 and Crystal Report 8. As years went by, he started working more on writing queries in SQL Server. He now has good level of knowledge in SQLServer, Oracle, MySQL and PostgreSQL as well. He is also one of the leading posters at and a moderator at His T-sql blog is at



1 Response to "Convert VarChar to Currency in SQL Server"
  1. albina N muro said...
    September 10, 2013 at 4:43 AM

    The geographic area in which a single currency would create the greatest economic benefit. While traditionally each country has maintained its own separate. gold buyers nj


Copyright © 2009-2014 All Rights Reserved for by Suprotim Agarwal | Terms and Conditions