Forum Discussion
Syndicate_Admin
3 years agoAdministrator
Issue passing variable to SQL Query
Hello I am writing a Power Query to extract data from a SQL Database. I wish to filter the data extracted. I have tried one step being the SQL query, and then the second step the filter, but th...
Syndicate_Admin
3 years agoAdministrator
Hello
Thank you for your suggestions.
I have made some changes and have shown below. This runs, returns the right result, but I am unsure if it works correctly.
Parameters (GetVar)
Code;
(ParameterName as text) =>
let
ParamSource = Excel.CurrentWorkbook(){[Name="Parameters"]}[Content],
ParamRow = Table.SelectRows(ParamSource, each ([Parameter] = ParameterName)),
Value=
if Table.IsEmpty(ParamRow)=true
then null
else Record.Field(ParamRow{0},"Input")
in
Value
Query with SQL
I let it run for 15 mins, it counted to 15million plus rows, then loaded 884k rows. So the right result, BUT;
Please can you advise is this is working correctly? The query in SQL Mgmt Studio takes about 50 seconds with the same parameters.
Thanks
Stuart