create procedure updateMergeServer ( name1 INT, name2 INT, name3 INT)
begin
declare i int;
declare j int;
declare y int;
set i = name1;
set j = name2;
set y = name3;
if i > 0 then
insert ignore into gameserver1.activity SELECT * FROM game_server2.activity;
--------------
在这里我想把写死的gameserver1换成可以拼的gameserver + i ,从而达到传进来几就向gameserver+?中合并表,求各位大神教我怎么写。
------解决思路----------------------
试试 exec('sql');
‘sql’自己拼串~~
------解决思路----------------------
对,拼接sql吧
------解决思路----------------------
试试!
exec('insert ignore into gameserver'+@i+'.activity SELECT * FROM game_server2.activity')