Escaping In Expressions

Posted on SQLIS See other posts from SQLIS
Published on Thu, 30 Oct 2008 17:18:12 +0100 Indexed on 2010/05/26 7:12 UTC
Read the original article Hit count: 329

Filed under:

The expressions language is a C style syntax, so you may need to escape certain characters, for example:

"C:\FolderPath\" + @VariableName

Should be
"C:\\FolderPath\\" + @VariableName

Another use of the escape sequence allows you to specify character codes, like this \xNNNN, where NNNN is the Unicode character code that you want. For example the following expression will produce the same result as the previous example as the Unicode character code 005C equals a back slash character:

"C:\x005CFolderPath\x005C" + @VariableName

For more information about Unicode characters see http://www.unicode.org/charts/

Literals are also supported within expressions, both string literals using the common escape sequence syntax as well as modifiers which influence the handling of numeric values. See the "Literals (SSIS)":http://msdn2.microsoft.com/en-US/library/ms141001(SQL.90).aspx topic.

Using the Unicode escaped character sequence you can make up for the lack of a CHAR function or equivalent.

© SQLIS or respective owner

Related posts about scripting