SSIS - The expression cannot be parsed because it contains invalid elements at the location specifie

Posted by simonsabin on SQL Blogcasts See other posts from SQL Blogcasts or by simonsabin
Published on Thu, 04 Mar 2010 09:56:12 GMT Indexed on 2010/03/11 17:21 UTC
Read the original article Hit count: 420

If you get the following error when trying to write an expression there is an easy solution

Attempt to parse the expression "@[User::FilePath] + "\" + @[User::FileName] + ".raw"" failed.  The token "." at line number "1", character number "<some position>" was not recognized. The expression cannot be parsed because it contains invalid elements at the location specified.

The SSIS expression language is a C based language and the \ is a token, this means you have to escape it with another one. i.e "\" becomes "\\", unlike C# you can't prefix the string with a @, you have to use the escaping route.

In summary when ever you want to use \ you need to use two \\


© SQL Blogcasts or respective owner

Related posts about Tips and Tricks

Related posts about SSIS - Integration Servic