Solved

Disallowed Implicit conversion from nVarChar to Money

Posted on 2011-03-07
3
611 Views
Last Modified: 2012-08-13
I keep getting disallowed Implicit conversion from nVarChar to Money for the column [Sum Of Gross] (see code)

I can't solve it when I try to convert...can anyone help?

Thanks
CASE WHEN (dbo.vwPayrollFinalCommission.[Sum Of Gross] - dbo.vwPayrollFinalCommission.[Sum Of NTU]) 
                      > dbo.PayrollTragets.InternalConsultantsTarget THEN (dbo.vwPayrollFinalCommission.[Sum Of Gross] - dbo.vwPayrollFinalCommission.[Sum Of NTU]) 
                      * 0.075 ELSE 0 END AS Comm3

Open in new window

0
Comment
Question by:Ed
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 3

Expert Comment

by:ccwill88
ID: 35054949
there have some char data in [Sum Of Gross]?
0
 
LVL 10

Expert Comment

by:Asim Nazir
ID: 35055005
try something like this:
AVG(cast(cast(TagValue as float) as decimal(38, 5))) AS Average
this happens whenn Value has Exponential part in it. Replace column name with yours.

Asim
0
 
LVL 39

Accepted Solution

by:
Pratima Pharande earned 500 total points
ID: 35055188

what are the datatype of [Sum Of Gross] and [Sum Of NTU]

I thnik [Sum Of NTU] is money or smething then in this you need to explicitly convert nvarcha to money like thi

CAST(dbo.vwPayrollFinalCommission.[Sum Of Gross] as money)

try this


 CASE WHEN (CAST(dbo.vwPayrollFinalCommission.[Sum Of Gross] as money) - dbo.vwPayrollFinalCommission.[Sum Of NTU])
                      > dbo.PayrollTragets.InternalConsultantsTarget THEN (CAST(dbo.vwPayrollFinalCommission.[Sum Of Gross] as money) - dbo.vwPayrollFinalCommission.[Sum Of NTU])
                      * 0.075 ELSE 0 END AS Comm3
0

Featured Post

Get MongoDB database support online, now!

At Percona’s web store you can order your MongoDB database support needs in minutes. No hassles, no fuss, just pick and click. Pay online with a credit card. Handle your MongoDB database support now!

Question has a verified solution.

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

In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
What if you have to shut down the entire Citrix infrastructure for hardware maintenance, software upgrades or "the unknown"? I developed this plan for "the unknown" and hope that it helps you as well. This article explains how to properly shut down …
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Via a live example, show how to shrink a transaction log file down to a reasonable size.

617 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