如何将它作为.sql文件快速插入大量数据? [英] How to insert large amount of data very quickly while take it as .sql file?

查看:167
本文介绍了如何将它作为.sql文件快速插入大量数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用下面的命令将数据导入到sql表中,我们可以使用命令提示符。



sqlcmd -S server\MYSQLSERVER -d demo - U Test -P test234 -i C:\ Users\rja \Desktop\Ra\dbo.WebBP.sql



它的工作原理很好。



如果* .sql文件大小超过3 GB。插入超过半天需要时间。



但是,我需要立即插入。



请有人帮助我。



我的尝试:



我在sql server中尝试导入数据。但这不起作用。

Using below command you import the data to sql table, using command prompt we can.

sqlcmd -S server\MYSQLSERVER -d demo -U Test -P test234 -i C:\Users\rja\Desktop\Ra\dbo.WebBP.sql

Its working fine.

If *.sql file size is more than 3 GB. It takes time to insert more than half a day.

But, I need to insert immediately.

Please anyone help me.

What I have tried:

I tried import data in sql server. But that is not working.

推荐答案

假设在基础追加期间瓶颈是网络传输。

您可以使用2步法。

1)在服务器上创建一个具有正确结构的导入基础。

2)将您的数据从客户端复制到服务器上的导入库。

3)将'import'基地附加到实际基地(数据已经是本地的)

4)删除'import'base

这可以避免网络传输速度慢附加到数据库。
Assuming the bottle neck is network transfert during base appending.
You can use a 2 steps method.
1) create an 'import' base with right structure on server.
2) copy your data from client to 'import base on server.
3) append the 'import' base to real base (the data is already local)
4) delete 'import' base
This avoid the slow network transfert during appending to database.


这篇关于如何将它作为.sql文件快速插入大量数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆