[dba-SQLServer]Convert Varchar(50) to Money

Billy Pang tuxedo_man at hotmail.com
Thu Nov 6 12:06:16 CST 2003


Number formatting should be done on the application level.
but if you must, here it is...

DECLARE @the_value VARCHAR(50)

SET @the_value = '30'

PRINT '$' + CAST(CAST(@the_value AS decimal(9,2)) AS VARCHAR(10))

HTH
Billy


>From: "Nicholson, Karen" <knicholson at gpsx.net>
>Reply-To: dba-sqlserver at databaseadvisors.com
>To: "Dba-Sqlserver (E-mail)" <dba-sqlserver at databaseadvisors.com>
>Subject: [dba-SQLServer]Convert Varchar(50) to Money
>Date: Thu, 6 Nov 2003 12:14:13 -0500
>
>I need to convert a field that is a varchar(50) to money.  The data looks
>like this: $29.95 or ($29.95).
>
>Any ideas?
>_______________________________________________
>dba-SQLServer mailing list
>dba-SQLServer at databaseadvisors.com
>http://databaseadvisors.com/mailman/listinfo/dba-sqlserver
>http://www.databaseadvisors.com
>

_________________________________________________________________
Protect your PC - get McAfee.com VirusScan Online  
http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963



More information about the dba-SQLServer mailing list