动态sql跟where条件时,记得加两个引号

set @x ='testX';
set @b='"AA"';
set @sqll= concat('select * from ',@x,' where name =',@b);
prepare stmt from @sqll;
EXECUTE stmt

猜你喜欢

转载自www.cnblogs.com/liyunchuan/p/12632301.html