SA-MP Forums Archive
How to? BIG SQL UPDATE query? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: How to? BIG SQL UPDATE query? (/showthread.php?tid=390582)



How to? BIG SQL UPDATE query? - 13th - 06.11.2012

Hi, how would you go about updating a big amount of data in SQL? I need to update hundreds of rows, I would need a string array close to 100 000 letters.

Basically I would need to do something like
Код:
UPDATE table SET X = Y WHERE ID = Z
for hundreds of rows.


Re: How to? BIG SQL UPDATE query? - steki. - 06.11.2012

Take WHERE out.


Re: How to? BIG SQL UPDATE query? - 13th - 06.11.2012

Quote:
Originally Posted by Stewie`
Посмотреть сообщение
Take WHERE out.
Uh.. yeah. but every Y is unique to every ID.


Re: How to? BIG SQL UPDATE query? - Emmet_ - 06.11.2012

Split it up.

Example:
pawn Код:
new query[152];
format(query, sizeof(query), "UPDATE `table` SET `field1` = 'value', `field2` = 'value', `field3` = 'value', `field4` = 'value', `field5` = 'value', `field6` = 'value' WHERE `blah` = 'blah'");
mysql_query(query);

format(query, sizeof(query), "UPDATE `table` SET...");
mysql_query(query);



Re: How to? BIG SQL UPDATE query? - 13th - 07.11.2012

Quote:
Originally Posted by Emmet_
Посмотреть сообщение
Split it up.

Example:
pawn Код:
new query[152];
format(query, sizeof(query), "UPDATE `table` SET `field1` = 'value', `field2` = 'value', `field3` = 'value', `field4` = 'value', `field5` = 'value', `field6` = 'value' WHERE `blah` = 'blah'");
mysql_query(query);

format(query, sizeof(query), "UPDATE `table` SET...");
mysql_query(query);
Yeah, that's probably the way to go Thanks!