Question

In MySQL, the following:

SELECT '\\' INTO OUTFILE 'c:/temp/backslash.dump';

writes two backslashes to the file, which makes sense.

Trying to dump a single backslash, I changed SQL_MODE, like that:

SET SESSION SQL_MODE='NO_BACKSLASH_ESCAPES';
SELECT '\' INTO OUTFILE 'c:/temp/backslash.dump';

but got two backslashes again.

Is there a way to dump a single backslash?

Was it helpful?

Solution

Do this:

SELECT '\\' INTO OUTFILE 'c:/temp/backslash.dump' FIELDS ESCAPED BY '|';
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top