1

How do I retrieve data from one MySQL table and store the data into another database table on the same server. I have tried this code but keep getting errors:

CREATE PROCEDURE `ProfusionTest` () 
LANGUAGE SQL 
NOT DETERMINISTIC 
MODIFIES SQL DATA 
SQL SECURITY DEFINER 
BEGIN 

DELETE FROM `Profusion`.`source_cdr`; 

INSERT INTO 
    `dest_table`.`create_info` 
    SELECT * FROM `Profusion`.`source_cdr`; 

END
  • 1
    put delete after insert – user1931858 Dec 14 '13 at 19:28
1

In same server you just need to use alter table to do that.

ALTER TABLE `old_db.foo` RENAME `new_db.foo`;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.