I recently ran across an issue that is really annoying. I use a plugin to display my TSQL scripts in the original formatting. Unfortunately it does not maintain that original formatting in all areas.
The specific case I ran into deals with the word “TEXT.” When using that word as a part of a FOR XML Path statement, it gets upper cased. Upper case version of text is not a valid command for the FOR XML Path statement. It will cause an error. The code still showed it as lower case when I went to edit it, but the display of the code was what was changed.
The only workaround is to leave a note stating that it should be LCASE instead of UCASE.