|
meanmyrlin
Starting Member
15 Posts |
Posted - 2008-12-10 : 16:06:27
|
| Hello,I am trying to figure out why I am getting the error message:"The data types decimal and int are incompatible in the boolean XOR operator."I am running the query:Select IPF.AlgCode, IPF.ChromeStyleid, IPF.NcodeL, IPF.NcodeM, IPF.NcodeR, IPF.SaleYR, IPF.SaleMo, VIN, SaleType, Default_State, IPF.ModelYear, Mileage, SellingPrice, SalesCost, GrossProfit, DaysAtDealerShip, AgeInMo, LogDaysAtDealership,MileAdjPrice15K, MileAdjPrice21K, SampleSize, AvgDaysAtDealership, AvgMileAdjPrice, AvgLogDaysAtDealer,((DaysAtDealerShip-AvgDaysAtDealership)*(MileAdjPrice15K-avgmileadjprice)) / ((DaysAtDealerShip-AvgDaysAtDealership)^2)AS SumForLinearAdj,((LogDaysAtDealerShip-AvgLogDaysAtDealer)*(MileAdjPrice15K-avgmileadjprice)) / ((LogDaysAtDealerShip-AvgLogDaysAtDealer)^2)AS SumForLogLinearAdjFrom dbo.inventoryProFormatted IPFinner join (Select AlgCode, ChromeStyleid, NcodeL, NcodeM, NcodeR, SaleYR, SaleMo, Count(vin)AS SampleSize,ModelYear, Avg(DaysAtDealership) AS AvgDaysAtDealership, Avg(MileAdjPrice15K) AS AvgMileAdjPrice,Avg(LogDaysAtDealership) AS AvgLogDaysAtDealerFrom dbo.inventoryproformattedGroup by AlgCode, ChromeStyleid, NcodeL, NcodeM, NcodeR, SaleYR, SaleMo, ModelYear) Averageson ipf.algcode = averages.algcode andipf.chromestyleid = averages.chromestyleid andipf.ModelYear=averages.modelyear andipf.SaleMo = Averages.salemo andipf.saleyr = averages.saleyrIf I remove the section:((LogDaysAtDealerShip-AvgLogDaysAtDealer)*(MileAdjPrice15K-avgmileadjprice)) / ((LogDaysAtDealerShip-AvgLogDaysAtDealer)^2)AS SumForLogLinearAdjThe query runs fine. I do not have any boolean statements in the query and the data types of the section causing the error are the same as the ones for the almost identical equation that proceeds it.Any suggestions would be greatly appreciated. I apologize for the poor formatting; I can't seem to tab or space at the beginning of a line in this window.Thanks,Natasha |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-12-10 : 16:13:40
|
Instead of using "^" as a mean to multiply with self, because "^" means XOR in t-sql, use(LogDaysAtDealerShip - AvgLogDaysAtDealer) * (MileAdjPrice15K - avgmileadjprice) / power(LogDaysAtDealerShip - AvgLogDaysAtDealer, 2) AS SumForLogLinearAdj E 12°55'05.63"N 56°04'39.26" |
 |
|