Solved

Disallowed Implicit conversion from nVarChar to Money

Posted on 2011-03-07
3
594 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
Comment Utility
there have some char data in [Sum Of Gross]?
0
 
LVL 10

Expert Comment

by:Asim Nazir
Comment Utility
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
Comment Utility

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

Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

Join & Write a Comment

In this article I will describe the Detach & Attach method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.

763 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

10 Experts available now in Live!

Get 1:1 Help Now