未加星标

SSIS Appetizer: XML source is already sorted

字体大小 | |
[数据库(mssql) 所属分类 数据库(mssql) | 发布者 店小二05 | 时间 2017 | 作者 红领巾 ] 0人收藏点击收藏

Case

I have a largeXML filewith Orders and Onderlines which I want to (merge) join into a new destination. To join the two outputs I need to order them, but the sort transformation takes too much time. Is there a fasteralternative?


SSIS Appetizer: XML source is already sorted
XML Source with two joined outputs

Solution

The solution is surprisingly quite simple: the outputs are already sorted and you only have to tell SSIS that (Similar to a source with order by in the query).

For XML files with multiple levels (first for orders and second for orderlines) like below, SSIS will create two output ports.


SSIS Appetizer: XML source is already sorted
XML Sample

The outputs will have an extra bigint column which allows you to connect the orderlines to the correct order.


SSIS Appetizer: XML source is already sorted
Two outputs with additionalID column

Instead of using these ID columns in the SORT transformations, you can also use the advanced editor of the XML source to tell SSIS that these columns are already sorted. Right click the XML source and choose 'Show Advanced Editor...'.


SSIS Appetizer: XML source is already sorted
Show Advanced Editor...

Then go to the last page 'Input and Output Property' and select the Orderline output. In the properties of this output you can tell SSIS that the output is sorted.


SSIS Appetizer: XML source is already sorted
Set IsSorted to true

Next expand OrderLine and then Output Columns and click on the additional ID column 'Order_Id'. In its properties locate the SortKeyPosition and change it from 0 to 1.


SSIS Appetizer: XML source is already sorted
Set SortKeyPosition to 1

Repeat this for the second output called 'Order' and then close the advanced editor. If you still have the SORT transformations, you will notice the yellow triangle with the exclamation mark in it. It tells you that the data is already sorted and that you can remove the SORT transformations.

And if you edit the Data Flow Path and view the metadata you will see that the column is now sorted.


SSIS Appetizer: XML source is already sorted
Sorted! Remove the SORT transformations!
Conclusion

The solution is very simple and perhaps this should have been the default sort key position anyway? It smells like a bug to me...


SSIS Appetizer: XML source is already sorted
No sorts!

本文数据库(mssql)相关术语:熊片数据库 mssql数据库 oracle数据库 pubmed数据库 access数据库 万方数据库

主题: XML
分页:12
转载请注明
本文标题:SSIS Appetizer: XML source is already sorted
本站链接:http://www.codesec.net/view/530051.html
分享请点击:


1.凡CodeSecTeam转载的文章,均出自其它媒体或其他官网介绍,目的在于传递更多的信息,并不代表本站赞同其观点和其真实性负责;
2.转载的文章仅代表原创作者观点,与本站无关。其原创性以及文中陈述文字和内容未经本站证实,本站对该文以及其中全部或者部分内容、文字的真实性、完整性、及时性,不作出任何保证或承若;
3.如本站转载稿涉及版权等问题,请作者及时联系本站,我们会及时处理。
登录后可拥有收藏文章、关注作者等权限...
技术大类 技术大类 | 数据库(mssql) | 评论(0) | 阅读(42)