Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Implicit Conversion Problem with Money

Status
Not open for further replies.

nutrotek

Technical User
Aug 10, 2006
8
US
Trying to run the following query using field Cost(Money):

CASE WHEN Cost IS NULL THEN 'N/A' ELSE CONVERT (MONEY, Cost , 1) END

I get an implicit conversion. How do I fix?
 
1) in order to display n/a you have to make it varchar, you can't mix datatypes. what is the datatype of Cost ? you should be able to do this with a simple COALESCE and convert instead of CASE

2) do not use money because it causes rounding errors


Denis The SQL Menace
--------------------
SQL Server Code,Tips and Tricks, Performance Tuning
SQLBlog.com
Google Interview Questions
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top