我正在尝试创建一个存储过程来将表的整个内容复制到另一个
CREATE PROCEDURE copytbl
BEGIN
INSERT INTO `comparison2` (`id`, `Split/Skil`, `Skill State`, `Agents Staffed`, `Calls Waiting`, `Oldest Call Waiting`, `ACD Calls`, `Avg ACD Time`, `Aban Calls`, `Avg Aban Time`, `Avg Speed Ans`, `ABANDON30`)
SELECT * FROM `comparison`
END
两个表都具有相同的格式,我在尝试创建过程时不断收到此错误:
1064 - 您的SQL语法出错;检查与MySQL服务器版本对应的手册,以获得正确的语法
靠近'BEGIN INSERT INTO
comparison2
(id
,Split/Skil
,Skill State
,`代理商Sta'在第2行
答案 0 :(得分:1)
使用此:
DELIMITER $$
DROP PROCEDURE IF EXISTS copytbl$$
CREATE PROCEDURE copytbl()
BEGIN
INSERT INTO `comparison2` (`id`, `Split/Skil`, `Skill State`, `Agents Staffed`, `Calls Waiting`, `Oldest Call Waiting`, `ACD Calls`, `Avg ACD Time`, `Aban Calls`, `Avg Aban Time`, `Avg Speed Ans`, `ABANDON30`)
SELECT * FROM `comparison`;
END$$
DELIMITER ;
执行程序:
CALL copytbl();