Forum Discussion
JonathanLewis
May 29, 2019Copper Contributor
Using Excel Column for Dynamic SQL Power Query
I am having difficulty using an existing excel column to create a dynamic SQL power query. In the below link there are two example to make this work. https://techcommunity.microsoft.com/t5/BI-and...
SergeiBaklan
May 29, 2019Diamond Contributor
Hi Jonathan,
In such case I'd use something like
MyParameters = "1,2",
Source = Sql.Database("MyServer", "MyDatabase"),
Query = Value.NativeQuery(Source,"
-- here is SQL body
WHERE (T3.INTCOLUMN_1 = 1) AND ( T3.INTCOLUMN_2 IN (" & MyParameters & ") )
")
With parameter you pass into the query string as "'1,2'". Perhaps it could be split somehow, not sure.