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.