UPDATE: the bio may contain apostrophes (see updated example)
I have an SQL query that has a value which spans multiple lines and it causes the query to fail:
UPDATE User SET UserId=12345, Name="J Doe", Location="USA", Bio="I'm a
bio that has an apostrophe, and I'm
spanning multiple lines!"
WHERE UserId=12345
In C# you can put an @
before the string Bio=@"..."
in order to allow it to span multiple lines, but I'm not sure how the same thing can be achieved with SQL queries. How do you get a string to span multiple lines without having to do things like manually concatenating the strings:
Bio="I'm a"
+" bio that has an apostrophe, and I'm"
+" spanning multiple lines!"
SQL Server allows the following (be careful to use single quotes instead of double)
UPDATE User
SET UserId = 12345
, Name = 'J Doe'
, Location = 'USA'
, Bio='my bio
spans
multiple
lines!'
WHERE UserId = 12345