【发布时间】:2015-07-19 03:56:28
【问题描述】:
我需要获取非规范化数据并创建规范化表。
我不知道如何获取要插入连接表的详细 ID(下例中的 StoreAddress.AddressID)。
如果我在循环中作为 T-SQL 中的存储过程执行此操作,我将在将行插入 Address 后使用 @@IDENTITY 来获取密钥,然后使用它插入 StoreAddress。我不知道如何在 SSIS 2012 中使用转换。
以商店和地址为例。
输入数据如下:
Store, Type, Address1, City, State
1, P, 123 Main, Central, PA
1, M, 123 Second, Central, PA
2, P, 123 Third, Pokono, NY
2, M, 123 Third, Pokono, NY
目标表是: 存储(已经填充在不同的数据流中)
StoreID, StoreName, StoreNumber
9878, Main street, 1
561, Mountain View, 2
AddressType(已经填充在不同的数据流中)
AddressTypeID, Code, Description
1, P, Physical
2, M, Mailing
3, O, Other
地址
AddressID, Addr1, City, State
721, 123 Main, Central, PA
843, 123 Second, Central, PA
1098, 123 Third, Pokono, NY
商店地址
StoreID, AddressID, AddressTypeID
9878, 721, 1
9878, 843, 2
561, 1098, 1
561, 1098, 2
我认为这应该是一个相当普遍的转换,并且在 SSIS 中有一个最佳实践来完成它。
感谢您考虑我的问题!
提姆
【问题讨论】:
标签: sql-server ssis jointable ssis-2012