Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


row copy from 1 db to another

row copy from 1 db to another

row copy from 1 db to another

Want to copy a row from one database to another on different servers - have googled this and sql now looks like


  INTO server1.db.table
     (field1, field2)
  FROM server2.db.table
where id = '1'

unfortunatley i get error


Error Code : 1064
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.table

I think this is because both the source db/table names are the same as the target db/table names.
Is this correct?

How do i get round this?

thanks MG

RE: row copy from 1 db to another

I don't think this is possible.

Where did google show you how this can be done?


RE: row copy from 1 db to another

hi - thanks for your reply, is there a work around?
the reason is in case I need to restore rows from a backup
thanks MG

RE: row copy from 1 db to another

There is probably no simple answer to this because it depends upon your database design and application / system requirements.

What are the circumstances that rows can be lost and need to be restored?  

There are plenty of MySQL backup tools that can restore tables.


RE: row copy from 1 db to another

Can restore whole tables no probs - is needed when someone "accidentally" deletes a row (which is rare)   

RE: row copy from 1 db to another

There are several possible solutions to this problem.  A couple of  suggestions are:


Each morning make a copy of the table on the server that the user is using.  Allow the user the option of recovering his data from that copy.


When the user deletes a record, keep it in the table but have a deleted flag in the record which effectively hides the record from processing (except when the user wishes to recover it).
The main point is don't use the backup from another server as this is intended to recover from system/hardware failures and not from users "accidentally" deleting records.


Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close