Solved

Disallowed Implicit conversion from nVarChar to Money

Posted on 2011-03-07
3
597 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:edjones1
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

How to leverage one TLS certificate to encrypt Microsoft SQL traffic and Remote Desktop Services, versus creating multiple tickets for the same server.
I have a large data set and a SSIS package. How can I load this file in multi threading?
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed

912 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

16 Experts available now in Live!

Get 1:1 Help Now