在我们的一张表上运行插入时出现上述错误。
AdmFormData 有 3 个主键,FormType、KeyField 和 FieldName。
有人知道我做错了什么吗?
set rowcount 0
go
INSERT INTO AdmFormData
(
[FormType]
,[KeyField]
,[FieldName]
,[AlphaValue]
,[NumericValue]
,[DateValue]
)
SELECT
'CUS' AS [FormType]
,Customer as [KeyField]
,'SAL001' AS [FieldName]
,[Customer Territory] AS [AlphaValue]
,NULL AS [NumericValue]
,NULL AS [DateValue]
FROM
dgl_territory a
LEFT OUTER JOIN AdmFormData f
on f.FormType = 'CUS' and f.FieldName = 'SAL001' and f.KeyField = a.Customer
WHERE f.FormType IS NULL