gpt4 book ai didi

ssis - 可以在 SSIS 中实现运行总和,而无需任何手动编码吗?

转载 作者:行者123 更新时间:2023-12-04 18:20:27 25 4
gpt4 key购买 nike

我有一个必须运行总计的场景,我可以通过纯 T-SQL 或脚本任务来实现这一点。但我想避免手动编码,并使用 ETL 工具功能。是否可能以及如何。

我有表余额

SELECT '00000001' AS [AccountNo], CONVERT(date,'20080828') AS [Date],10 AS [DailyMovement]
INTO balances
UNION ALL
SELECT '00000001' AS [AccountNo], CONVERT(date,'20080829') AS [Date],5 AS [DailyMovement]
UNION ALL
SELECT '00000001' AS [AccountNo], CONVERT(date,'20080830') AS [Date],7 AS [DailyMovement]
UNION ALL
SELECT '00000002' AS [AccountNo], CONVERT(date,'20080828') AS [Date],8 AS [DailyMovement]
UNION ALL
SELECT '00000002' AS [AccountNo], CONVERT(date,'20080829') AS [Date],6 AS [DailyMovement]

我得到了这样的结果。
SELECT b1.[AccountNo]
, b1.[Date]
, b1.[DailyMovement]
, SUM(b2.[DailyMovement]) AS [RunningTotal]
FROM balances b1
INNER JOIN balances b2 ON b1.[AccountNo] = b2.[AccountNo]
AND b1.[Date] >= b2.[Date]
GROUP BY b1.[AccountNo],b1.[Date],b1.[DailyMovement];

想在 SSIS 中执行此操作而无需手动编码

最佳答案

您是否尝试添加查询

SELECT b1.[AccountNo]
, b1.[Date]
, b1.[DailyMovement]
, SUM(b2.[DailyMovement]) AS [RunningTotal]
FROM balances b1
INNER JOIN balances b2 ON b1.[AccountNo] = b2.[AccountNo]
AND b1.[Date] >= b2.[Date]
GROUP BY b1.[AccountNo],b1.[Date],b1.[DailyMovement];

到 oledbsource 以将其用作 Source,然后直接将其指向 oledbdestination?

关于ssis - 可以在 SSIS 中实现运行总和,而无需任何手动编码吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10798177/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com