MYSQL:如何将结果集转储到 LONGTEXT 变量而不是输出文件中
我想修改以下代码:
SELECT * INTO OUTFILE 'C:\\my_excel_table.csv'
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
LINES TERMINATED BY '\r\n'
FROM mytable;
以便将结果转储到长文本/变量中,而不是输出文件中。
I want to modify the following code:
SELECT * INTO OUTFILE 'C:\\my_excel_table.csv'
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
LINES TERMINATED BY '\r\n'
FROM mytable;
so that it dumps the result into longtext/variable rather than to a output file.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不确定是否可以,但有
INSERT 。 .. SELECT FROM
语法,它允许您将选择的结果插入到另一个表中。问题是 SELECT 将返回行,这些行将被逐一插入到另一个表中,而不是作为单个长文本块插入。Not sure if you can, but there is the
INSERT ... SELECT FROM
syntax, which lets you insert the results of a select into another table. Problem is thatSELECT
is going to return rows, which would be inserted one-by-one into the other table, instead of going in as a single long chunk of text.使用 插入选择
use insert select