【发布时间】:2016-12-28 01:07:21
【问题描述】:
我有一个包含 2000 行数据的 Excel 电子表格。我需要创建一个 SQL 脚本来将数据插入到表中。下面是我在 Excel 中使用的公式,它适用于创建插入语句,但如果 DiagnosisCode 已经存在,我该如何“不插入”?
= "INSERT INTO CommonDiagnosis (DiagnosisCode, Description, ActiveThru, ActiveThruEnteredBy, DiagnosisFormat) VALUES('" & A3 & "', '" & B3 & "', '" & C3 & "', '" & D3 & "', '" & E3 & "')"
【问题讨论】:
-
不要使用 VALUES,而是使用 SELECT [cell values] 语句,这样您就可以包含 WHERE DiagnosisCode NOT IN([cell value])
-
@柴雄。你能进一步解释一下吗?也许是一个例子