d29*_*907 3 ssis oledbcommand sql-update
我需要在 SSIS 中翻译下一个 SQL 查询:(每个表属于不同的源 - SQL Server & ORACLE)
update A
set
A.col1 = B.col1
A.col2 = B.col1
from
table A inner join table B B on A.col3 = Col3
where
A.col4 = value 1 and
A.col5 = value2 and
B.col4 = value 3;
Run Code Online (Sandbox Code Playgroud)
如您所见,源和目标对应于相同的源:表 A。这是我创建的工作流。

在条件拆分之后,我使用了一个派生列来复制列 B.Col1 以在 OLE DB 命令上使用它来更新表 A 的列之后,我在 OLE DB 命令中编写了下一段查询任务:
update Table A
set
col1 = ?
col2 = ?
Run Code Online (Sandbox Code Playgroud)
但此时我有一个问题,我是只更新我从条件拆分中获得的子集的值,还是更新所有表 A。此外,更新查询的最后部分引用了表 B 和 in OLE DB 命令任务我只能参考一个数据源。
澄清: 代码只是一个模式,所以我不需要更正它,这不是我的疑问(以防我犯了错误)。
我被要求在不修改 sql 查询的情况下进行此翻译。
如果您需要了解更多信息以提供帮助,请询问,但要礼貌。
问候
SQL 命令任务中的更新需要如下所示:
update Table A
set
col1 = ?
col2 = ?
WHERE SomeColumn = ?
Run Code Online (Sandbox Code Playgroud)
其中“SomeColumn”是唯一标识行的列,您需要在数据流中具有“SomeColumn”的值,以便您可以将其映射到 SQL 命令中的第三个参数。
如有必要(根据您的原始更新判断),您可以从数据流中映射多个列,实际上您可以在 SQL 命令中使用原始查询:
update A
set
col1 = ?
col2 = ?
where
? = value 1 and
? = value2 and
? = value 3;
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
13493 次 |
| 最近记录: |