Expression help

  • mikesql710

    SSC Enthusiast

    Points: 195


    I am using this expression in precedence constrain. If it is true, then go to the next step.

    SUBSTRING(@FileName,"MyNetworkFolder\\xyz*.xls",1) > 0 ? "True" : "False"

    For some reason, the expression didn't like *. What I am trying to do here is. If the variable @FilaName has file name start with Xyz and extension only .xls

    Any thoughts?

  • Phil Parkin

    SSC Guru

    Points: 244662

    "for some reason..."

    SUBSTRING() does not work with wildcards.

    Something like this should do the trick:

    upper(left(token( @FileName,"\\",tokencount( @FileName, "\\" )), 3)) == "XYZ" && upper(right(token( @FileName,"\\",tokencount( @FileName, "\\" )),4)) == ".XLS"?"TRUE":"FALSE"

    If the answer to your question can be found with a brief Google search, please perform the search yourself, rather than expecting one of the SSC members to do it for you.
    See for details of how to post T-SQL code-related questions.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply