使用SSIS分开多个多重价值列将表分开

发布于 2025-02-08 07:36:03 字数 1454 浏览 0 评论 0 原文

我尝试在线搜索解决方案,但无法走远。我正在使用SSIS迁移XLSX数据集(其中2个)来拥有SQL数据库。 这是我的数据集: dataset 。从: https://wwww.kaggle.com /DATASET/SHIVAMB/AMAZON-PRIME-MOVIES and-TV-SHOWS

如您所见,带有多个多价值列的单个表。因此,我将其标准化为与台产品相关联的导演,演员,国家 /地区之类的桌子。

我遵循了这篇文章的迁移:

还有其他使用相同解决方案的文章和建议。

我的问题是脚本组件不起作用。这是我遇到的错误: 脚本组件错误

带有以下脚本:

​输出为Regisseur。这就是错误消息说“对象引用未设置为对象实例”的原因。瑞士式桌子具有PK身份和导演名称的名称。

有什么想法吗?如果可以解决此问题,我可以完成数据库迁移的其余部分。

编辑:我忘了在本文中提及一个可能的解决方案: https://www.techrepublic.com/article/aarticle/a-super-aper-easy-easy-way-way-to-generate-new-new-rements-from--------多价值柱子 - 使用 - 示例 - Query/

这将在源文件中创建很多记录。在我的SQL数据库中将这些数据迁移到自己的表中时,诸如产品之类的桌子将具有很多重复项。如果文章是任何解决方案,这是另一个问题。

但是我不知道这是否可能,我没有经验。

I tried searching for solutions online but couldn't come far. I'm using SSIS to migrate xlsx datasets(2 of them) to own SQL database.
This is my dataset: dataset. Downloaded from: https://www.kaggle.com/datasets/shivamb/amazon-prime-movies-and-tv-shows

As you can see, single table with multiple multi-valued columns. So I normalized this into tables with like Director, Actor, Country with association to table Product.

I followed this article for the migration: http://microsoft-ssis.blogspot.com/2012/11/split-multi-value-column-into-multiple.html

There are other articles and suggestions that uses the same solution.

My problem is that the Script Component is not working. This is the error I get:
Script Component Error

With the following script: script

I commented out the example code since I don't have State column but you might also notice that I only have director as a single input from source and output as regisseur.SSIS My idea is that there is no record of regisseur in the destination database, which is the reason for the error message saying 'object reference not set to instance of an object'. The regisseur table has a PK Identity and a name for the Director's name.

Any ideas? I can do the rest of the database migration if I can fix this problem.

EDIT: I forgot to mention a possible solution in this article: https://www.techrepublic.com/article/a-super-easy-way-to-generate-new-records-from-multi-value-columns-using-excels-power-query/

This would create a lot of records in the source file. When migrating these data to their own tables in my SQL database, tables like Product would have lots of duplicates. Which is another issue, if the article is of any solution.

But I don't know if this is possible, I don't have experience in this.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

明媚殇 2025-02-15 07:36:03

解决问题的解决方案是使用命令“ tokencount”和“令牌”,并与“ foreach loop容器”和“用于循环容器”结合使用。

使用“ tokencount”,找到分隔符的数量以确定循环执行的数量。在“ For Loop容器”中,您可以使用“令牌”将数据分开。接下来,使用获得的数据运行插入脚本。

The solution to your problem is to use the commands "TOKENCOUNT" and "TOKEN" and combine with "Foreach Loop Container" and "For Loop Container".

Using "TOKENCOUNT", find the number of separators to determine the number of loop executions. In "For Loop Container" you can use "TOKEN" to separate the data. Next, run the Insert script using the data obtained.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文