I have the following SQL insert statement.\[code\]insert into [dbo].[Lookup] (XMLField) select '<root>' + '<SQL>' + SQLQueryToEscape + '</SQL>' + '</root>' as CustomData from dbo.CustomView \[/code\]My dilemma is that the SQLQueryToEscape has characters in it that aren't XML safe. I need to escape the string. What is the best way to do this in tSQL?