Concating the variables into SQL query in Azure Data Factory pipeline

AP 156 Reputation points
2021-12-14T06:12:18.223+00:00

Hi,

I am having trouble concating variables into this query. Please help

SELECT '411D2DF4-0E28-488B-A95D-ghjkhjkhjkhjkjk' as Site,Periodendtime as utcSampledatetime,Periodendtime as Sampledatetime, [test.test.test] as Feed, [test.test.test] as Prim_Prod,[test.test.test] as Sec_Prod
from
(SELECT PeriodEndTime, sourcefqn, quantity
from [testExt].[dbo].fn_test_Movements_GetFiltered
where SourceFQN in ('test.test.test.test', 'test.test.test.test', 'test.test.test')) AS X
PIVOT (MAX(QUANTITY) FOR sourcefqn IN ([test.test.test], [test.test.test1],[test.test.test2])) AS PIV

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

Accepted answer
  1. ShaikMaheer-MSFT 38,301 Reputation points Microsoft Employee
    2021-12-14T17:47:34.093+00:00

    Hi @AP ,

    Thank you for posting query in Microsoft Q&A Platform.

    You can consider using string interpolation syntax. Click here to know more about it.

    Below is the query which you can try in your case.

    SELECT '411D2DF4-0E28-488B-A95D-ghjkhjkhjkhjkjk' as Site,Periodendtime as utcSampledatetime,Periodendtime as Sampledatetime, [test.test.test] as Feed, [test.test.test] as Prim_Prod,[test.test.test] as Sec_Prod
    from
    (SELECT PeriodEndTime, sourcefqn, quantity
    from [testExt].[dbo].fn_test_Movements_GetFiltered
    where SourceFQN in ('test.test.test.test', 'test.test.test.test', 'test.test.test')) AS X
    PIVOT (MAX(QUANTITY) FOR sourcefqn IN ([test.test.test], [test.test.test1],[test.test.test2])) AS PIV

    Hope this helps. Please let us know if any further queries. Thank you.

    ----------------

    Please consider hitting Accept Answer button. Accepted answers helps community as well.


0 additional answers

Sort by: Most helpful