Fastest transfer of data from MSSQL to MySQL via PHP -
i need store data remote ms sql db local mysql db; need using php.
the fetching of data mssql simple enough:
select orderref , ordervalue remotetbl
this results in 100k rows. want store in local mysql database using php. enough, can (with addition of field want) :
while(list($orderref, $ordervalue) = mssql_fetch_array($result)){ mysql_query("insert localtbl (orderref, ordervalue, updated) values ('$orderref', '$ordervalue', now())"); } // done rows
this seems wasteful 100k rows of data though.
is there way can more efficiently?
updated further comments:
by using php resource mssql query perhaps? need things data, , mssql dbms read only.
thanks
you should use mysqli since mysql functions aren't going around more speed 1 big insert statement so.
$sql = "insert localtbl (orderref, ordervalue, updated) values "; while(list($orderref, $ordervalue) = mssql_fetch_array($result)){ $sql_rows[] = "('$orderref', '$ordervalue', now())"; } mysql_query($sql . implode(',', $sql_rows) . ';');
Comments
Post a Comment