如何根据SSI中数据来自的表添加列?

发布于 2025-01-29 05:24:28 字数 743 浏览 4 评论 0原文

我有两个源表:

  1. ext_agreements
  2. abs_agreements

都具有相同的列:“每个表都有不同的数据,这只是一个示例:“

                          ID, START_DATE,  END_DATE, 
                          01, 28/02/2021, 04/05/2021
                          02, 11/10/2021, 09/01/2022
                          03, 08/01/2022, 03/05/2022

我想将它们合并到目标数据库中的一个表中,同时通过维护协议类型的信息添加一个基于协议源表的“协议_TYPE”列“协议”或“ ABS”。

目的表将有:

                          ID, START_DATE,  END_DATE, AGREEMENT_TYPE
                          01, 28/02/2021, 04/05/2021,  ABS
                          02, 11/10/2021, 09/01/2022,  EXT
                          03, 08/01/2022, 03/05/2022,  ABS

我尝试了合并和联合所有和派生的列,但我没有成功。 谢谢

I have two source tables:

  1. Ext_Agreements
  2. ABS_Agreements

both have the same columns : "each table have different data this is just an example"

                          ID, START_DATE,  END_DATE, 
                          01, 28/02/2021, 04/05/2021
                          02, 11/10/2021, 09/01/2022
                          03, 08/01/2022, 03/05/2022

I want to merge them in one table in the destination Database, while maintaining the information of the type of the agreement by adding a columns "AGREEMENT_TYPE" that contain "Ext" or "ABS" based of the source table of the Agreement.

the destination table will have :

                          ID, START_DATE,  END_DATE, AGREEMENT_TYPE
                          01, 28/02/2021, 04/05/2021,  ABS
                          02, 11/10/2021, 09/01/2022,  EXT
                          03, 08/01/2022, 03/05/2022,  ABS

I tried merge and Union All and derived columns, but I didn't succeed.
thank you

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

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

发布评论

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

评论(2

離殇 2025-02-05 05:24:28

如果要使用SSI,则...

在数据流中。

基于:

select ID, START_DATE,  END_DATE --, AGREEMENT_TYPE = 'EXT'
from Ext_Agreements

添加派生的列并添加:

AgreementType and set (DT_WSTR, 3) "EXT"

对ABS(源和DER Col)进行相同的操作。

然后将它们放在联合车中。

If you want to use SSIS, then...

In data flow.

Create a source based on:

select ID, START_DATE,  END_DATE --, AGREEMENT_TYPE = 'EXT'
from Ext_Agreements

Add a derived column and add:

AgreementType and set (DT_WSTR, 3) "EXT"

Do the same this for ABS (source and der col).

Then put them together in a UnionAll.

∞觅青森が 2025-02-05 05:24:28

来源中的一个工会怎么样。

select ID, START_DATE,  END_DATE, AGREEMENT_TYPE = 'EXT'
from Ext_Agreements
UNION ALL
select ID, START_DATE,  END_DATE, AGREEMENT_TYPE = 'ABS'
from ABS_Agreements

How about a UNION ALL in your source.

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