Solved

Convert to money SQL

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

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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Composite queries are used to retrieve the results from joining multiple queries after applying any filters. UNION, INTERSECT, MINUS, and UNION ALL are some of the operators used to get certain desired results.​
How to leverage one TLS certificate to encrypt Microsoft SQL traffic and Remote Desktop Services, versus creating multiple tickets for the same server.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

813 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now