
Hey guys,
I'm trying to build a dynamic SQL query in power automate desktop that uses a string value to access other variables declared along the flow.
While testing, I made a loop iteration that sets a string variable to a template like this one:
Query =
'%%item['LegalEntityName']%%',
'%%item['RegistrationNumber']%%',
'%%item['OrganisationId']%%',
'%%item['ParentOrg']%%',
'%%item['Status']%%',
'%%item['TnCsRequired']%%',
'%%item['City']%%'
I used double % so the flow identity those as literals.
Without the double quotes, the flow would try to access the variable, which were not declared yet.
Then, in a further step, I tried this in the "Execute SQL Statement".
INSERT INTO %Ambient%_%CurrentTable%
VALUES ( %Query% )
The problem is, the variables references inside the query are not being used to access their correspoding values, instead, the flow is sending the literal text as an SQL string.
Is there a way to make this work?
Thanks in advance