SSIS: The column with the sortkeyposition value of 1 is not valid. It should be 0

Recently, while working on one of the existing SSIS package, we found that there were number of sort blocks in SSIS where as it could have been sorted at the source itself and informing the SSIS package that the data is already sorted at the source and can be processed further.

Another disadvantage of using Sort blocks in SSIS package itself is it loads the entire data into memory and performs sorting. Also, sorting in the SSIS package takes more time as compared to sorting at the source/SQL server for which we may get out of memory exception which will be explained in another blog.

So, to fix this issue, we sorted the data at the source using order by statement of SQL as shown:

1

Then, we did set the other required values by Right Click -> Show Advanced Editor

4

Go to Input and Output Properties Tab and set IsSorted as True as shown:

2

Then set  SortKeyPosition as 1 for the column from Output Columns section which is included in the order by statement in the source query.

3

NOTE: We can set SortKeyPosition value(starting with 1) as the same order in which the columns are appearing in Order By statement in source SQL query e.g. we can set SortKeyPosition as 2 for totalsales, 3 for AvgSalesLast3Months and 4 for OrganisationId if the SQL query at source is like below:

“select .. from TableName order by Product,totalsales,AvgSalesLast3Months,OrganisationId”.

After performing all these steps, when we created a link between the OLEDB Sources and Merge Join(existing) block, we got the error saying: “The column with the sortkeyposition value of 1 is not valid. It should be 0“.

After searching over internet for this issue, we figured out that it seems to be an issue with the SSIS itself for which it’s unable to resolve the references.

To fix this, we deleted the merge join block and created one more and selected required columns from both the sources and it worked.

5

We followed the same approach for removing as many sort blocks as possible.

Hope it helps !!

Advertisement

3 thoughts on “SSIS: The column with the sortkeyposition value of 1 is not valid. It should be 0

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.