SSIS : How to handle Multi select lookup column va

2019-05-28 17:07发布

I have a requirement to extract Sharepoint list data and import them in SQL Server Tables.

I am able to do this using the SSIS Data Flows including Derived Columns and Data Conversion controls. I am also able to convert Single Line, Multi line, Date, lookup(Single selection) data types to the SQL data types.

But now, my question is for Lookup column with Multi Select :

  1. What should be the expression used in Derived Column- for converting the data to comma separated values?

    Below expression I am using to get the ID from lookup column for Single Selection.

    SUBSTRING(Business,1,FINDSTRING(Business,";#",1) - 1)

enter image description here

If you see above screen shot, from the Public List output, it shows Future Risk Mitigation Controls are semicolon separated with multiple values in one row.

At Derived column output, it has taken only first ID and placed in the Risk Controls column.

Now questions are :

  • Should we get these IDs comma separated and store it as varchar in SQL Table ?
  • OR, we should have multiple rows to separate the options.

For example,

ID    RiskControls
 1       1
 1       3

Also, I have another question related to the Data Import.

  1. Where do we need to set that, this package would drop or delete all the existing rows of the table and insert all of them again ?

Please help me on this.

Thank you, Mittal.

1条回答
ら.Afraid
2楼-- · 2019-05-28 17:50

This is odd, but there is another question on the forum today, which appears very similar: How to use Substring in SSIS

I would suggest parsing the controls in a script task and breaking them into multiple rows, if these will be important for analysis. It will be far more difficult to do that in SQL, comparatively.

For your other question, you can use an execute SQL task to issue a Truncate table statement prior to the data flow executing.

查看更多
登录 后发表回答