A
A
Alexander2016-10-09 01:45:49
MySQL
Alexander, 2016-10-09 01:45:49

How to change/update many records quickly?

There is a product catalog on the site. There is an accounting program 1C. Everything in the same local network, 1C and the site use MS SQL.
It is necessary to update the catalog of goods on the site from 1C (product names and other information).
If to do update on 1 record it will be very long.
Is there any way to do it faster? Or an algorithm for such a download?
Another question is, what if the goods have not been unloaded before? Do I need to do select first, and only then update or insert? Is there a faster way?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Taratin, 2016-10-09
@Taraflex

INSERT INTO table (id, a,b,c) VALUES 
(9999, 1,2,3),
(9998, 4,5,6) //и таких строк сколько угодно пока укладываемся в ограничение на длину запроса
  ON DUPLICATE KEY UPDATE `a`=VALUES(`a`), `b`=VALUES(`b`), `c`=VALUES(`c`);

Read more dev.mysql.com/doc/refman/5.7/en/insert-on-duplicate...

A
Albert Kazan, 2016-10-09
@Farrien

SELECT all records
WHILE these records
in each WHILE do UPDATE

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question