This question comes from one of our power users: ToddN2000.
I'm trying to join 2 tables and it keeps failing. I did not create the tables and I cannot change them. One has the order defined as NUMERIC(8) the other has the order defined VARCHAR(15). I have tried using CAST, CONVERT, ISNUMERIC and combinations of them with no luck.
I'm trying to join a summarized version by division, warehouse, product class, customer to the master.
Running the SQL below gives the error:
Msg 8114, Level 16, State 5, Line 1
Error converting data type varchar to numeric.
sum(SAEXT$) as csext$sum,
sum(SANET$) as csnet$sum,
sum(SAFEXT$) as csfext$sum,
sum(SAFNET$) as csfnet$sum,
CAST(SAORDER as varchar(15)) as cssaorder
from [SAWh].[SalesManager].[Cognos] as cs
left join [Corp].[FactoryOrder].[SalesReport] as sr
on SAORDER = sr.FactoryOrderNumber
group by SADIV,SAWH,SAPCLS,SABTKY,SAORDER,SASUFX
Free Guide: Managing storage for virtual environments
Complete a brief survey to get a complimentary 70-page whitepaper featuring the best methods and solutions for your virtual environment, as well as hypervisor-specific management advice from TechTarget experts. Don’t miss out on this exclusive content!