In MySQL things were simple - got a nasty character, put a backslash in front of it, the simple and straightforward standard method of escaping characters. MSSQL on the other hand, being an utter bitch and proprietary piece of total E36 M3, seems to have a different method of escaping each troublesome character. I've figured them all out except the double quote. "" can go into a query but it still comes back out as "". This seems to be the greatest MSSQL mystery of them all. Using the ESCAPE command isn't an option - the queries have to be compatible with other, decent database servers and I've already had to do heavy modifications to the app to make it work with MSSQL.
Also if you can tell me why newline characters - backslash r backslash n - are actually showing in the output instead of a newline, that would be nice too.
My deepest sympathies if you need to work with this thing on a regular basis.
I have to hurry up and finish this thing so that I can then write another app to translate database queries from real SQL to TSQL >:(
EDIT: D'oh figured it out, you don't escape them at all.