select * into outfile的问题 我想事先定义好输出的文件名,而不是写死在语句里,但是就是不行set @fname=concat(curdate(),'table1.txt');select * into outfile @fnamefrom table1;请高手指教! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 用prepare就可以实现步骤如下:mysql>set @fname=concat(curdate(),'table1.txt');mysql>set @s=concat('select * into outfile "',@fname,' "from table1');mysql>prepare stmt;mysql>execute stmt;就可以在你要导出数据的表的数据库目录下找到刚刚导出的文件. set names gbk;set @fname=concat(curdate(),'table1.txt');prepare s1 from 'select * into outfile @fname from table1';execute s1;deallocate prepare s1; 关于MYSQL索引 配对逻辑。比较复杂。有兴趣的可以试试。 mysql if中不能定义游标吗? PostgreSQL建表 主键自增类型如何搞定? windows下怎么修改mysql的数据库目录? 请教mysql简单问题,谢谢大家, 请教:如何修改mysql中表的属性? 查询,插入问题,望高手帮助,谢谢! MYSQL 筛选想要的信息 分区表 opening table mysql中文乱码 php调用webservise显示正常 ms sql可以在存储过程中用opensource来访问另一台电脑中的ms sql数据库,以达到分布式事务.
步骤如下:
mysql>set @fname=concat(curdate(),'table1.txt');
mysql>set @s=concat('select * into outfile "',@fname,' "from table1');
mysql>prepare stmt;
mysql>execute stmt;
就可以在你要导出数据的表的数据库目录下找到刚刚导出的文件.
execute s1;
deallocate prepare s1;