0

I generated a SQL Server data-only .SQL file with SQL Server Management Studio.

The file is looks like this:

Insert Into .....
Insert Into .....
Insert Into .....

I have about 950000 rows like that in my file. But when I tried to split the file to 5000 rows part and run it over my local SQL Server, it takes 4 to 5 min for each part.

How can I Insert this file faster? Any ideas?

Thanks

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
msd
  • 591
  • 7
  • 23
  • how many columns there in this table ? Any triggers? It takes a lot time 5000 rows/5 minutes. – Whencesoever May 30 '17 at 06:25
  • It has 31 columns. There is no trigger. I'm just seeking for a faster way to insert. – msd May 30 '17 at 06:28
  • You will need to specify more information. Where is the data coming from? Is it based on a query? Is it involving multiple tables? What kind of indexes are there on the target table? What disk system is the table residing on? – SchmitzIT May 30 '17 at 06:33
  • 1
    You might want to try inserting data into a csv file and then read it with OPENROWSET. The fastest option would be to create a linked server I believe. – PacoDePaco May 30 '17 at 06:33
  • @PawełKucharski Can I change this file? Or I must create new csv file form source DB? – msd May 30 '17 at 06:44
  • 1
    You would have to create a new file using tips from (https://stackoverflow.com/questions/14212641/export-table-from-database-to-csv-file) question – PacoDePaco May 30 '17 at 07:05
  • How many indexes does the target table have? – DancingFool May 30 '17 at 07:49
  • It has 4 indexes – msd May 30 '17 at 07:57

0 Answers0