Si está de acuerdo con un comando SQL que se distribuye en varias líneas, entonces oedo sugerencia es la más fácil:
INSERT INTO mytable (myfield) VALUES ('hi this is some text
and this is a linefeed.
and another');
Acabo de tener una situación en la que era preferible tener la instrucción SQL en una sola línea, así que descubrí que una combinación de CONCAT_WS()
y CHAR()
funcionó para mí.
INSERT INTO mytable (myfield) VALUES (CONCAT_WS(CHAR(10 using utf8), 'hi this is some text', 'and this is a linefeed.', 'and another'));