Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Dynamic Parameters for an SQL Stored Procedure

Up until today I have been able to use a function to define the parameters of a Stored Procedure call that I'm making on an Azure SQL database.  I have done quite a lot of testing to conclusively narrow down that the problem is dynamically assigning the parameter to this query.

 

If i use a dynamic parameter in my Power Query code, Power BI service will prevent me from refreshing.  This worked all the way up until yesterday (8th April 2018).

 

Here is a forum post that I have created which provides a number of details:

 

https://community.powerbi.com/t5/Service/Has-the-ability-to-refresh-a-dataset-with-a-dynamic-SQL-sto...

 

 

The following code will not allow refreshes: (where fnStartDate and fnEndDate are functions to dynamically return dates)

Source = Sql.Database("Example042.database.windows.net", "Example-DB", [Query="Exec APAC_Example.[sp_Example] 0, " & fnStartDate & ", " & fnEndDate & ", 'EP231%'", HierarchicalNavigation=true, CommandTimeout=#duration(0, 0, 90, 0)]),

The following code will allow refreshes:

Source = Sql.Database("Example042.database.windows.net", "Example-DB", [Query="Exec APAC_Example.[sp_Example] 0, '2016-01-01', '2019-01-01', 'EP231%'", HierarchicalNavigation=true, CommandTimeout=#duration(0, 0, 90, 0)]),

 

Status: New
Comments
v-qiuyu-msft
Community Support

Hi @Anonymous,

 

I have sent a email to consult this issue internally. Will update here once I get any information. 

 

Best Regards,
Qiuyun Yu 

v-qiuyu-msft
Community Support

Hi @Anonymous,

 

I got information that the fix will be available on prod by 4/23/2018.

 

Best Regards,
Qiuyun Yu 

Anonymous
Not applicable

Thank you!

v-qiuyu-msft
Community Support

Hi @Anonymous,

 

Please test again to see if the issue is gone now. 

 

Best Regards,
Qiuyun Yu 

Anonymous
Not applicable

Yes this is now fixed. Thank you very much.