Copy data Activity

Rohit Kulkarni 441 Reputation points
2021-03-18T16:53:20.697+00:00

Hello Team,

I am running the script in query :

79247-image.png

Query :

@{pipeline().parameters.SelectClause}
from @{pipeline().parameters.Schema}.[@{pipeline().parameters.Companies[0]}$@{pipeline().parameters.TablesWithCompany[0]}]

@{pipeline().parameters.Companies[0] is in array
@{pipeline().parameters.TablesWithCompany[0]} is in array

I am getting error. Whether i am passing the parameter values wrong. Please advise

Failure happened on 'Source' side. ErrorCode=SqlOperationFailed,'Type=Microsoft.DataTransfer.Common.Shared.HybridDeliveryException,Message=A database operation failed with the following error: 'Invalid object name 'pool.VendorsV2'.',Source=,''Type=System.Data.SqlClient.SqlException,Message=Invalid object name 'pool.VendorsV2'.,Source=.Net SqlClient Data Provider,SqlErrorNumber=208,Class=16,ErrorCode=-2146232060,State=1,Errors=[{Class=16,Number=208,State=1,Message=Invalid object name 'pool.VendorsV2'.,},],'

Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
9,515 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. HimanshuSinha-msft 19,376 Reputation points Microsoft Employee
    2021-03-19T18:00:16.197+00:00

    Hello @Rohit Kulkarni ,
    Thanks for the ask and using the Microsoft Q&A platform .

    As I understand the intention here is to get a query like

    Select a,b,c from dbo.company1TablesWithCompany1, if yes please try and use the expression

    @{pipeline().parameters.SelectClause}  
    from @{pipeline().parameters.Schema}.@{pipeline().parameters.Companies[0]}@{pipeline().parameters.TablesWithCompany[0]}  
    

    I also suggest that you use the set variable activity to test this kind of query , I have found that to be very helpful . The animation below will make my implementation clear and also how I am using the set variable activity .

    79710-333.gif

    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


  2. HimanshuSinha-msft 19,376 Reputation points Microsoft Employee
    2021-03-24T04:19:08.393+00:00

    Hello @Rohit Kulkarni ,

    Since you shared the query , I think it gave a little bit more idea of the issue . If you see there is space in between Group and O .

    try the below expressiona nd it should work .

    @{pipeline().parameters.SelectClause}
    from @{pipeline().parameters.Schema}.[@{pipeline().parameters.Companies[0]}$@{pipeline().parameters.TablesWithCompany[0]}]

    Output :

    {
    "name": "queryOutput",
    "value": "Select a,b,c\nfrom [dbo.Group O$Vendor]"
    }

    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