从有自己规则的txt文件中批量插入

发布于 2024-10-08 22:42:56 字数 274 浏览 0 评论 0原文

我有一个 txt 文件,其中包含 350.000 行,我必须下载并将其插入到我的 sql server 数据库中。我写了连接FTP的部分获取相关文件并下载它。我想要的是将它插入到我的表中。

这是一行: 9996281000L0000000000000000

正如你所看到的,我需要分离特定的部分,例如
999 628 1000 L 0000000000000000

我需要一个有效的解决方案来剪切行并将数据插入到相关列。

有人有什么想法我可以如何实现这一目标吗?

I got a txt file which includes 350.000 lines and I have to download and insert it to my sql server database. I write the part that connects to FTP gets the related file and download it. What I want is insert it to my table.

Here's a line:
9996281000L0000000000000000

As you can see also I need to seperate the specific parts like
999 628 1000 L 0000000000000000

I need an effective solution which cuts the lines and inserts the data to related columns.

Anyone any ideas how I can achieve this?

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

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

发布评论

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

评论(1

一个人的旅程 2024-10-15 22:42:56

查看 BCP 实用程序及其格式文件。这是一个详细且有些复杂的过程,但一旦设置就会快速有效地完成工作。

您可以通过 SQL Server Integration Services (SSIS) 获得类似的功能(具有更好的 GUI)。虽然完全不同,但它与 bcp 的作用大致相同。

Look into the BCP utility and its format files. It's a detailed and somewhat complex process, but it will do the job quickly and efficiently once set up.

You can get similar functionality (with a much better GUI) with SQL Server Integration Services (SSIS). While completely different, it does much the same thing as bcp.

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