Unix Technical Forum

Copy data from MsSql database to a MySql database in batch mode.

This is a discussion on Copy data from MsSql database to a MySql database in batch mode. within the MySQL forums, part of the Database Server Software category; --> Hi all, anyone can say me something for give me the right way in obtain what i put in ...


Go Back   Unix Technical Forum > Database Server Software > MySQL

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-28-2008, 11:29 AM
Mauro
 
Posts: n/a
Default Copy data from MsSql database to a MySql database in batch mode.

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,
Mauro.


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-28-2008, 11:29 AM
J.O. Aho
 
Posts: n/a
Default 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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-28-2008, 11:29 AM
Mauro
 
Posts: n/a
Default Re: Copy data from MsSql database to a MySql database in batch mode.

> 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


Thanks Aho,
sure i try and i say you.
Sorry but i post in the Italian php newsgroup and no anyone reply me. So i
decide try in a MySql group.
Thanks for now.
Mauro.


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 02-28-2008, 11:29 AM
Mauroreggio@gmail.com
 
Posts: n/a
Default Re: Copy data from MsSql database to a MySql database in batch mode.

> 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


It Works.
Thanks Aho.
Bye.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 03:27 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com