从有自己规则的txt文件中批量插入
我有一个 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
查看 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.