Forum Discussion
schdef
9 years agoFrequent Visitor
Parameterized SQL Query with query folding
I have a table loaded to my data model containing IDs. I want use these IDs to filter another query connecting to a SQL table. I tried to merge the SQL query with the ID table but then the query does...
- Anonymous9 years ago
Hi schdef,
You can tansfrom your data to text, then use it into sql query.
Sample: Convert region records to text.
let Source=data, Region = "'"&Text.Combine(List.Distinct(Source[Region]),"','")&"'" in RegionInsert into sql query:
let Source = Sql.Database("xxxxx", "xxxxx", [Query="SELECT * FROM Sales WHERE Region In ("&Region&")"]) in SourceRegards,
Xiaoxin Sheng
Anonymous
9 years agoNot applicable
Hi schdef,
You can tansfrom your data to text, then use it into sql query.
Sample: Convert region records to text.
let
Source=data,
Region = "'"&Text.Combine(List.Distinct(Source[Region]),"','")&"'"
in
Region
Insert into sql query:
let
Source = Sql.Database("xxxxx", "xxxxx", [Query="SELECT * FROM Sales WHERE Region In ("&Region&")"])
in
Source
Regards,
Xiaoxin Sheng
Anonymous
6 years agoNot applicable
How would you do this for more than 1000 items in a list?
I am trying to send a list back to Oracle and there is a 1000 item limit in the where clause.
If anyone has any ideas about this or has gotten around it in any way please let me know.
I am very new to power query and welcome all feedback.
- lbendlin6 years ago
Super User
OR the requests together
where x in (,,,,,)
or x in (,,,,,)
or x in (,,,,,)
etc.