Problem with FINDSTRING in SSIS Expression

Jorge Hernán Ramírez Jaramillo 20 Reputation points
2024-05-02T21:57:47.1666667+00:00

Best regards.

I have a problem when I am trying to use the FINDSTRING function in SSIS of Visual Studio 2022. It gives me the following error, even when I try to use the reference examples from the Microsoft page (https://learn.microsoft.com/en-us/sql/integration-services/expressions/findstring-ssis-expression?view=sql-server-ver16). The expression on the Microsoft page that I am using is a very simple example and generates the error, as with all the expressions that I require:

FINDSTRING("New York, NY, NY", "NY", 3)

FINDSTRING(@[$Project::prmFileName], ".", 1)

LEFT(@[$Project::prmFileName], FINDSTRING(@[$Project::prmFileName], ".", 1) - 1)

TITLE: Expression Builder


Cannot convert expression value to property type.

For help, click: https://go.microsoft.com:80/fwlink?ProdName=Microsoft%C2%AE%20Visual%20Studio%C2%AE&ProdVer=17.9.34728.123&EvtSrc=Microsoft.DataTransformationServices.Controls.TaskUIFramework .TaskUIFrameworkSR&EvtID=CannotAssignExpressionToProperty&LinkId=20476


ADDITIONAL INFORMATION:

Cannot convert 'System.Int32' to 'System.String'.


SQL Server Integration Services
SQL Server Integration Services
A Microsoft platform for building enterprise-level data integration and data transformations solutions.
2,474 questions
0 comments No comments
{count} votes

Accepted answer
  1. Yitzhak Khabinsky 25,211 Reputation points
    2024-05-03T13:26:56.13+00:00

    Hi @Jorge Hernán Ramírez Jaramillo,

    It is much better to use tokenization for your scenario instead of string parsing.

    SSIS has for that TOKEN() function.

    To get file name without its extension, please try the following SSIS expression:

    TOKEN(@[$Project::prmFileName], ".", 1) 
    
    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful