all groups > sql server dts > january 2006 >
You're in the

sql server dts

group:

SSIS Merge Join and Sortkeyposition


SSIS Merge Join and Sortkeyposition sramshaw
1/6/2006 7:36:04 AM
sql server dts: I am attempting to join 2 tables on 2 columns with a left inner join, using a
merge join component. I set col1 to a sortkeypositiion of 1 and col2 to a
sortkeyposition of 2 (on both tables).

This consistently fails with the following:

'The column with the sortkeyposition value of 0 is not valid. It should be 2.'

I managed to get around this for a number of joins by sorting with a sort
component not at the oledbsource, but now I am getting this there as well.

Is this a feature, limitation, bug or am I missing something?

Re: SSIS Merge Join and Sortkeyposition Darren Green
1/7/2006 1:08:10 PM
[quoted text, click to view]

You may have already covered this, but sorting in the OLE-DB Source
should be much more efficient. Are sure you were describing the data as
sorted correctly? Set IsSorted on the output, and SortKeyPosition on the
columns to match your ORDER BY clause.

Some notes on sorting-
Sorting Data
(http://wiki.sqlis.com/default.aspx/SQLISWiki/SortingData.html)


--
Darren
http://www.sqldts.com
Re: SSIS Merge Join and Sortkeyposition sramshaw
1/9/2006 6:09:02 AM


[quoted text, click to view]
I appreciate your responses guys but I figured out how to resolve the
errors. It seems to be related to to joining on 2 columns. The first join
column needs to be in the resultset apparently. i.e. (pseudo code)

select table1.col3
from table1
inner join table2
on table1.col1 = table2.col1
and table1.col2 = table2.col2

generates the error, but this will not:

select table1.col1, table1.col3
from table1
inner join table2
on table1.col1 = table2.col1
and table1.col2 = table2.col2

Not sure at this time if the is a 'feature' or I am missing something. To
answer your questions yes, I have tried setting issorted, but that did not
help. I actually began with that because it is mandatory for a join unless
you sort the data with a sort component. Any further insights would still be
AddThis Social Bookmark Button