Re: Copy data from MsSql database to a MySql database in batch mode. Mauro wrote:
> Hi all,
> anyone can say me something for give me the right way in obtain what i put
> in the object?
> The batch procedure must run on a Linux Box.
> In this linux box, there are operative php page that read from the MsSql
> database, and all works good (mssql_connect,
> mssql_select_db .... )
> What i need is create a copy of some tables from the MsSql db to one new
> MySql db.
> The MySql db can be renew all the time that the batch procedure run.
> Thanks at all for your collaboration,
> regards,
I think this may have been better asked at alt.php.sql.
$mysql="DELETE FROM table";
mysql_query($mysql);
$mssql="SELECT * FROM table";
$msres=mssql_query($mssql);
while($row=mssql_fetch_row($msres)) {
$mysql="INSERT INTO table VALUES('{$row[0]}','{$row[1]}',...)";
mysql_query($mysql);
}
I do suggest you would make the following changes to the code:
1. Make a backup of the table in mysql before you delete all rows from it.
2. In the php code, make error checks and return both query and error, if
there would be some kind of error
--
//Aho |