Hi Stephen,

Oh yes, the second one will work fine. :-)

Note, however, that the string may not be *exactly* the same, even if it
appears to be. For example, if I copied the second query and executed it
on my Windows system, the newline would actually be \r\n and not just \n
as with the first query (since Windows uses \r\n to represent newlines).
So the inserted data would be one byte longer, even though it looks the
same.

For this reason, mysqldump (and others) always uses the first version,
to insure that the restored data is *exactly* the same.

Hope that helps.


Matt


----- Original Message -----
From: "Stephen Fromm"
Sent: Tuesday, November 11, 2003 4:17 PM
Subject: newlines and carriage returns in string data


> Is it OK to have actual newline/carriage return characters in string
data?
>
> E.g. consider the insert statement
> INSERT into table t1 ( ) VALUES('Here is a newline:\nThere it was!');
>
> Now consider the statement, typed as
> INSERT into table t1 ( ) VALUES('Here is a newline:
> There it was!');
>
> Is the second version legal?
>
> Another way of saying this (I guess) is:  what kinds of characters are
> allowed in a string constant?


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to