Solved

Convert to money SQL

Posted on 2010-08-16
3
483 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

Guide to Performance: Optimization & Monitoring

Nowadays, monitoring is a mixture of tools, systems, and codes—making it a very complex process. And with this complexity, comes variables for failure. Get DZone’s new Guide to Performance to learn how to proactively find these variables and solve them before a disruption occurs.

Question has a verified solution.

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

Naughty Me. While I was changing the database name from DB1 to DB_PROD1 (yep it's not real database name ^v^), I changed the database name and notified my application fellows that I did it. They turn on the application, and everything is working. A …
'Between' is such a common word we rarely think about it but in SQL it has a very specific definition we should be aware of. While most database vendors will have their own unique phrases to describe it (see references at end) the concept in common …
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

733 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