在SSIS中数据流任务后,如何执行SQL Server存储过程

发布于 2025-02-06 08:43:46 字数 476 浏览 1 评论 0原文

我是SSI的新手。我正在尝试创建一个ETL管道来自动化数据库的更新和删除过程。

我创建了一个数据流任务,该任务读取Excel文件并将数据发送到SQL Server中的各个分期表。

“

要在主数据库中更新数据,它必须在登台表中进行一些转换。我创建了一个存储过程,可以执行这些更改。

我希望通过数据流任务加载数据后立即将存储过程调用,而不是我去SSMS手动执行存储过程。

“存储过程”

我尝试在控制流量选项卡上添加“执行SQL Task”,但没有获得任何结果。

我想进一步在整个过程中在以后的步骤中添加更多转换。关于如何使整个过程更加方便的任何想法也将不胜感激。

I am new to SSIS. I am trying to create an ETL pipeline to automate the updating and deleting process for a database.

I have created a data flow task which reads the Excel file and sends the data to respective staging tables in SQL Server.

Data Flow

For the data to be updated in the main database, it has to go through some transformation in the staging tables. I have created a stored procedure that will enforce these changes.

I want the stored procedure to get called right after data is loaded through the data flow task to the staging tables rather than me going to SSMS to manually execute the stored procedure.

Stored procedure

I have tried adding the "Execute SQL Task" on the control flow tab but not getting any results.

I would like to further add many more transformations in this whole process in future steps. Any ideas on how to make this whole process more convenient would also be appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

逐鹿 2025-02-13 08:43:46

[数据流任务] - > [执行SQL任务]

配置执行SQL Task具有

EXECUTE dbo.MasterQuery;

基于存储过程的图像的直接输入值,看来您在那里有逻辑错误。

IF EXISTS(SELECT 1 FROM dbo.OutlookDataStg WHERE [Flag] = 'Outlook')
BEGIN
    UPDATE dbo.OutlookDataStg
    SET [Data Type] = 'Outlook'
    WHERE [Flag] = 'Actual'

-- Cut off at this point
END

提供的逻辑是

如果表dbo.outlookdatastg中至少有一个行中的一个行,则值标志是Outlook的位置,然后更新同一表,但将数据类型设置为具有实际标志的任何行的Outlook。

除非您有一些不寻常的条件,否则您将您混合了标志和数据类型值

[Data Flow Task] -> [Execute SQL Task]

Configure the Execute SQL Task with a Direct Input value of

EXECUTE dbo.MasterQuery;

Based on the image of your stored procedure, it would appear you have a logic error in there.

IF EXISTS(SELECT 1 FROM dbo.OutlookDataStg WHERE [Flag] = 'Outlook')
BEGIN
    UPDATE dbo.OutlookDataStg
    SET [Data Type] = 'Outlook'
    WHERE [Flag] = 'Actual'

-- Cut off at this point
END

The logic provided is

If there is at least one row in the table dbo.OutlookDataStg where the value flag is Outlook, then update the same table but set the Data type to Outlook for any rows with a flag of Actual.

Unless you have some unusual condition, it would see you've mixed your Flag and Data Type values

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文