How to? BIG SQL UPDATE query?
#1

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.
Reply
#2

Take WHERE out.
Reply
#3

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

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);
Reply
#5

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!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)