Solved

Disallowed Implicit conversion from nVarChar to Money

Posted on 2011-03-07
3
603 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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.
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Viewers will learn how the fundamental information of how to create a table.

685 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