locked
ADF - pass pipeline().Pipeline value as value to SQL QUERY RRS feed

  • Question

  • Hi All,

    I am struck on a point where I am not able to pass value of @pipeline().Pipeline to my SQL Query in ADF.

    I have a Lookup operation where I am trying to fetch parameter values against a given pipeline so I am comparing it with name i.e.

    Table: JobParameter

    1st Column: PipelineName

           Value: First_Pipe_Line

    2nd Column: ParameterValue

           Value: 20

    Running a pipeline named "First_Pipe_Line"

    have a LOOKUP activity where trying to write query:


    SELECT

       ParameterValue

    FROM 

       JobParameter WHERE PipelineName = @{pipeline.Pipeline}

    This is failing as @{pipeline.Pipeline} will be a CHAR value and is not in quote. Tried to use @CONCAT but not able to get the desired results which should be:

    SELECT

       ParameterValue

    FROM 

       JobParameter WHERE PipelineName = 'First_Pipe_Line'

    Tried:

    DECLARE @SQL VARCHAR(1000)

    SET @SQL ='SELECT ParameterValue FROM JobParameter WHERE PipelineName='+'''+@{pipeline.Pipeline}+'''

    EXECUTE (@SQL)

    But even this does not work.

    Please suggest me a right approach.

    Regards

    GS



    Regards Gursethi Blog: http://gursethi.blogspot.com/ ++++ Please mark "Propose As Answer" if my answer helped ++++

    Friday, December 6, 2019 6:41 AM

Answers

  • Please try below and let me know if that works. Screenshot of error would help.

    SELECT ParameterValue
    FROM MyTestTable
    WHERE PipelineName = '@{pipeline().Pipeline}'


    If the response helped, do "Mark as answer" and upvote it
    - Vaibhav

    Friday, December 6, 2019 7:00 AM

All replies

  • Please try below and let me know if that works. Screenshot of error would help.

    SELECT ParameterValue
    FROM MyTestTable
    WHERE PipelineName = '@{pipeline().Pipeline}'


    If the response helped, do "Mark as answer" and upvote it
    - Vaibhav

    Friday, December 6, 2019 7:00 AM
  • Thanks Vaibhav,

    Worked like a charm.


    Regards Gursethi Blog: http://gursethi.blogspot.com/ ++++ Please mark "Propose As Answer" if my answer helped ++++

    Monday, December 9, 2019 3:48 AM