Hello everyone, I am facing a problem.
I have two sql connections (two different server). I execute one query in the first connection and save the data in a variable (%QueryResult%). In the second connection I do another query but I want to put data from the first connection %QueryResult% into my sql query, but the result is always nothing.
Select
*
From
Tabel1
Where
List in (%QueryResult%)
QueryResult = Datatable :
Name111
Name112
Name113
Name114
When I do it directly in MS SQL Server Management Studio i would usually type in
Select
*
From
Tabel1
Where
List in
('Name111',
'Name112',
'Name113',
'Name114')
Do some have a solution?
Hi, I think the issue you faced was the conversion between variable types, can you click on the %QueryResult% in variable pane while the process was executed and post the screen capture so I can help you sort things out ?
Hello @Stelles3000
You have to convert from Datatable to List at first.
Use action "Retrieve data table column into list" to do so.
Then use the action "Join text" to convert the list into a comma-separated string. Since we need to enclose each value in quotation marks, we need to set the custom delimiter to ','.
Finally, pass a comma-separated string to the IN operator of the WHERE clause of the SQL statement. Don't forget to enclose variable in quotation marks.
SELECT * FROM [Employees]
WHERE [LastName] IN ('%JoinedText%');
Best Regards.
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
Announcing a new way to share your feedback with the Power Automate Team.
Learn to digitize and optimize business processes and connect all your applications to share data in real time.