我有以下代碼來計算重量,但是當我運行它我得到算術溢出錯誤將表達式轉換數據類型爲nvarchar
算術溢出錯誤將表達式轉換數據類型爲nvarchar
UPDATE T1
SET [1 WO # WGHT] = CASE
WHEN t2.[WEIGHT] = 'NMI' THEN 0
WHEN t2.[WEIGHT] = '' THEN 0
WHEN t2.[WEIGHT] IS NULL THEN 0
ELSE CAST(t2.[WEIGHT] AS float)
END
FROM [PACKING SLIPS] T1
INNER JOIN inserted i ON T1.[AUTO PACK SLIP #] = i.[AUTO PACK SLIP #]
CROSS APPLY
(SELECT TOP 1 *
FROM [WORKORDERS] T2
WHERE T1.[1. WO #] = T2.[WORK ORDER NO.]) T2
可能重複[錯誤無法將數據類型nvarchar轉換爲浮點數](https://stackoverflow.com/questions/26765604/error-unable-to-convert-data-type-nvarchar-to-float) – Tanner
什麼所涉及的所有表的定義是什麼? –