gpt4 book ai didi

mysql - 在mysql中使用 "load data into outfile"时如何转义(\t\n\r)?

转载 作者:行者123 更新时间:2023-11-29 20:58:22 24 4
gpt4 key购买 nike

mysql中使用“load data into outfile”时如何转义(\t\n\r)?

我尝试过这样做:

select * from user INTO OUTFILE FIELDS TERMINATED BY '\t' ESCAPED BY '\\' LINES TERMINATED BY '\n' 

但是好像不行

我需要一个例子。

谢谢

如果我将一个值插入到字段 var 中,内容为“\r\n”:

+----+------+------+
| id | var | var2 |
+----+------+------+
| 1 |
| test |
+----+------+------+

然后,运行

SELECT * FROM `test` into OUTFILE '/tmp/out.log' FIELDS TERMINATED BY '\t' ESCAPED BY '\\' LINES TERMINATED BY '\r\n';

“out.log”:

1       \
test

ASCII:31 09 5c 0d 0a 09 74 65 73 74 0d 0a

但我想逃避0d 0a

最佳答案

select * from user INTO OUTFILE 'path' FIELDS TERMINATED BY '\t' ESCAPED BY '\\' LINES TERMINATED BY '\r\n'; 

关于mysql - 在mysql中使用 "load data into outfile"时如何转义(\t\n\r)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37435144/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com