Using item() in Lookup Activity within a ForEach

Mike Kiser 1,536 Reputation points
2021-03-01T18:03:41.45+00:00

Hello
@Nasreen Akter @MartinJaffer-MSFT

My next bug is that I am trying to use an item() in a Lookup Query within a ForEach loop. My Query is
SELECT fullname, emailaddress
FROM [MercerStagingDev].[MILKY-WAYTEST\AppSQLVST4DotNetDev-R].[EmployeeVendors]
WHERE employeeid = item().employeeId

but I am getting the following error:
,Source=,''Type=System.Data.SqlClient.SqlException,Message='item' is not a recognized built-in function name.,Source=.Net SqlClient Data

How can I lookup a value if I can't use the item() which is the employeeid that the ForEach is iterating through? or any variable within the query?

Thanks again so much!
Mike Kiser

73085-image.png

Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
11,113 questions
{count} votes

Accepted answer
  1. HimanshuSinha-msft 19,476 Reputation points Microsoft Employee
    2021-03-01T18:14:17.143+00:00

    Hello @Mike Kiser ,
    Thanks for the ask and using the Microsoft Q&A platform .

    Put the below expression in the query and it should work .( remove white spaces )

    @concat('SELECT fullname, emailaddress  
    FROM [MercerStagingDev].[MILKY-WAYTEST\AppSQLVST4DotNetDev-R].[EmployeeVendors]  
    WHERE employeeid =', item().employeeId)  
    

    Please do let me know how it goes .
    Thanks
    Himanshu
    Please do consider to click on "Accept Answer" and "Up-vote" on the post that helps you, as it can be beneficial to other community members

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.