views:

744

answers:

1

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?

+1  A: 

Do this:

SELECT '\\' INTO OUTFILE 'c:/temp/backslash.dump' FIELDS ESCAPED BY '|';