The Code as below, the offending statement higjlighted
UPDATE B_ServiceLabour
SET
YearPeriod=rtrim(ltrim(YearPeriod)),
OrderNumber=rtrim(ltrim(OrderNumber)),
LineNumber=rtrim(ltrim(LineNumber)),
ActivityNo=rtrim(ltrim(ActivityNo))
Import_Step6:
-- delete existing data
TRUNCATE TABLE [Jedox_prod].[dbo].[F_ServiceOrderCostValues]
Import_Step7:
-- Insert new data
INSERT INTO F_ServiceOrderCostValues
([Period],
[OrderNumber],
[LineNumber],
[ActivityNo],
[Reference1],
[Reference2],
[CostComp],
[Amount],
[Unit],
[CostPrice],
[CostCur],
[CostCtrct],
[CostWarr],
[CostInvc],
[CostOth],
[SalesPrice],
[SalesCur],
[SalesCtrct],
[SalesWarr],
[SalesInvc],
[SalesOth],
[Company],
[DataType],
[InvoiceNo],
[InvoiceDate],
[AmountHC],
[USD],
[USD_PlanRate],
[EUR],
[GBP],
[NewRecord])
SELECT
B_ServiceLabour.YearPeriod,
B_ServiceLabour.OrderNumber,
B_ServiceLabour.LineNumber,
B_ServiceLabour.ActivityNo,
B_ServiceLabour.Reference1,
B_ServiceLabour.Reference2,
B_ServiceLabour.CostComp,
convert(float,B_ServiceLabour.Quantity),
B_ServiceLabour.Unit,
convert(float,B_ServiceLabour.CostPrice),
B_ServiceLabour.CostCurrency,
convert(float,B_ServiceLabour.CostCtrct),
convert(float,B_ServiceLabour.CostWarr),
convert(float,B_ServiceLabour.CostInvc),
convert(float,B_ServiceLabour.CostOth),
convert(float,B_ServiceLabour.SalesPrice),
B_ServiceLabour.SalesCurrency,
convert(float,B_ServiceLabour.SalesCtrct),
convert(float,B_ServiceLabour.SalesWarr),
convert(float,B_ServiceLabour.SalesInvc),
convert(float,B_ServiceLabour.SalesOth),
B_ServiceLabour.Company,
B_ServiceLabour.DataType,
B_ServiceLabour.InvoiceNo,
(select
case when InvoiceDate IS NULL THEN ''
else convert(datetime,InvoiceDate,3)
end),
0,0,0,0,0,-1
FROM B_ServiceLabour
END
The error is
Msg 8114, Level 16, State 5, Procedure P_Service OrderCostValues_F, Line 18
Error converting data type nvarchar to float.
many thanks