I believe that what Greg suggests is mssql specific, because 'for xml path' is not available in mysql (for example).
What you can do is to simply insert those PK column's values into a temp table that you can inner join later which should be the same effect.. without using any sort of variables.. If you need to persist that table over connection then try use ##myTable format (double hash) - they will not be droped once connection is changed and will be accessible over to other users too..
So to be more generic, i've tried to do this using expressions in the Set variable activities and i can't manage to do some easy-to-understand workaround, because the single/double quotes are being stripped off for some odd reasons.. I consider this as a wrong way how 'string' values are handled in the expression engine - an opportunity for improvement for the future..
But even if i'd succeed in this then it will still be "ugly" solution.. i was thinking of some more elegant way like just passding the #mySqlVariable.PKColumn" but this feature only takes the "current" row (current row from the loop dataset activity)... I think we should expand this feature and let the user to decide which row to use..
My idea is something like this:
Select * from myTable where pkColumn in #mySqlVar# ---- first row and first column
Select * from myTable where pkColumn in #mySqlVar.PKColumn# ---- current row of a specific column (in loop dataset activity)
Select * from myTable where pkColumn in #mySqlVar.PKColumn[6 ]# ---- 7th row of a specific column (indexed from 0)
Select * from myTable where pkColumn in #mySqlVar.PKColumn[* ]# ---- all rows of a specific column (transposed into 'a', 'b', 'c' ... or 1, 2, 3 (for numeric types))
Select * from myTable where pkColumn in #mySqlVar[6 ]# ---- 7th row of the first column
Select * from myTable where pkColumn in #mySqlVar[* ]# ---- all rows and first column (transposed)
What do you think guys?