Solved

Convert to money SQL

Posted on 2010-08-16
3
482 Views
Last Modified: 2012-05-10
I have a value of ($6.53) that I need to convert to money.  The () is messing up the following syntax so I need to know how to work around it.

convert(money, sales)

Any help here?
0
Comment
Question by:mattkovo
3 Comments
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 500 total points
ID: 33449296
this should do
convert(money, replace(replace(sales, '(', ''), ')', '' )

Open in new window

0
 
LVL 16

Expert Comment

by:vdr1620
ID: 33449308
Well, i don't see any difference with and Without () .. but you think removing () will solve your problem use replace

SELECT CONVERT (MONEY,REPLACE(REPLACE(Sales,'(',''),'(',''))
0
 
LVL 9

Expert Comment

by:sureshbabukrish
ID: 33452768
select convert(money, ABS(sales))

probably the value ($6.53) is shown here should be a negative number and try using ABS function to negate it
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hi all, It is important and often overlooked to understand “Database properties”. Often we see questions about "log files" or "where is the database" and one of the easiest ways to get general information about your database is to use “Database p…
I'm trying, I really am. But I've seen so many wrong approaches involving date(time) boundaries I despair about my inability to explain it. I've seen quite a few recently that define a non-leap year as 364 days, or 366 days and the list goes on. …
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question