【发布时间】:2016-07-28 12:19:23
【问题描述】:
(SQL Server 2008 上的投标)
我有一个平面文件(管道分隔),我已成功将其解析为以下格式:
AccountID FreeText1 FreeText2 FreeText3 FreeText4
1 Some text More text Other text Different Text
2 Some text More text Other text Different Text
3 Some text More text Other text Different Text
我需要这样的最终结果:
AccountID Title TheData
1 FreeText1 Some text
1 FreeText2 More text
1 FreeText3 Other text
1 FreeText4 Different Text
2 FreeText1 Some text
2 FreeText2 More text
2 Freetext3 Other text
2 FreeText4 Different Text
3 FreeText1 Some text
3 FreeText2 More text
3 FreeText3 Other text
3 FreeText4 Different Text
我对 SSIS 还是比较陌生,所以边走边学。我在 Unpivot 转换中找到的所有东西似乎都是我需要的,但我无法根据列的名称(“FreeText1”等)弄清楚如何将它拿到 Unpivot,我也无法完全掌握如何设置 Unpivot 变换以接近预期结果。
我还没有找到任何可以在派生列中使用以编程方式获取列名的 SSIS 公式,我想也许我可以在派生列中生成列名,然后将两者合并在一起......但是似乎不是一种非常有效的方法,无论如何我都无法使其工作。我尝试设置派生列以硬代码返回列名(例如,使用“FreeText1”作为公式),但是我仍然不确定如何将其与 Unpivoted 结果结合起来。
任何意见将不胜感激!
【问题讨论】:
标签: sql-server-2008 ssis bids unpivot