Click here to Skip to main content
15,886,963 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
SQL
IF
(SELECT T0.[Price] FROM ITM1 T0  INNER JOIN OPLN T1 ON T0.PriceList = T1.ListNum WHERE T1.[ListName] = $[RDR1.U_SBO_PriceList]
and  T0.[ItemCode] = $[RDR1.ItemCode]) > $[RDR1.PriceBefDi]

BEGIN
(SELECT T0.[Price] FROM ITM1 T0  INNER JOIN OPLN T1 ON T0.PriceList = T1.ListNum WHERE T1.[ListName] = $[RDR1.U_SBO_PriceList]
and  T0.[ItemCode] = $[RDR1.ItemCode])
END

ERROR:
[Microsoft][ODBC Driver 13 for SQL Server][SQL Server]Error converting data type nvarchar to numeric.  '' (RDR1)


What I have tried:

I tried to compare two prices, the price in the Sales document and the price in the PriceList and choose the greater one.
Posted
Updated 27-Oct-23 5:05am
v3
Comments
Richard MacCutchan 26-Oct-23 9:22am    
One of the prices is stroed as a nvarchar type instead of a numberic.

1 solution

Without knowing the data types of the different fields in your query, this is impossible to answer. What we do know is that one of your fields is a string (NVARCHAR), and you are trying to treat it as a number. Take a look at the types of your fields and use that to work out which one is the problem.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900