Using item() in Lookup Activity within a ForEach

Mike Kiser 1,536 Reputation points

@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


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

Accepted answer
  1. HimanshuSinha-msft 19,381 Reputation points Microsoft Employee

    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 .
    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