Smart questions
Smart answers
Smart people
Join Tek-Tips Forums
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login




Remember Me
Forgot Password?
Join Us!

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • 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!

Join Tek-Tips
*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.
Jobs from Indeed

Link To This Forum!

Partner Button
Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

row copy from 1 db to another

thompom (TechnicalUser) (OP)
7 Jul 11 12:27
Hi,
Want to copy a row from one database to another on different servers - have googled this and sql now looks like

CODE

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

unfortunatley i get error

CODE

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
towerbase (Programmer)
11 Jul 11 4:09
I don't think this is possible.

Where did google show you how this can be done?

Andrew

thompom (TechnicalUser) (OP)
11 Jul 11 4:14
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
towerbase (Programmer)
11 Jul 11 4:25
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.

Andrew

thompom (TechnicalUser) (OP)
11 Jul 11 4:42
Can restore whole tables no probs - is needed when someone "accidentally" deletes a row (which is rare)   
towerbase (Programmer)
11 Jul 11 11:47
There are several possible solutions to this problem.  A couple of  suggestions are:

Quote:

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.

Quote:

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.

Andrew

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!

Back To Forum

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