Forum Discussion
Call an SP
Hi gijeet,
I've leant SQL for years as well and be glad to meet someone who has the similar experience :) . Through an interface is also not prefered for me, however I think it might be the savior for the ones who have no any SQL or coding experience.
Regarding your question, calling stored produres with parameters, I've made some research and found some tricks.
e.g. In SQL Server, supposing there exists a stored proce in testdb of testserver.
CREATE PROC p4test @PARAM VARCHAR(200) AS BEGIN SELECT @PARAM CONTENT END
- Click "Edit Queries" in the "Home" tab, a "Query Editor" window pops up.
- Click "New Source" ->"SQL Server" and fill the "server","database","Sql Statement" with "testServer","testdb","exec p4test 'goodday'", click ok.
- Click on that query on the left panel and click "Advanced Editor" in "Home" tab, and paste the below code
let
SQLSource = (param as text) =>
let
Source = Sql.Database("testserver", "testdb", [Query="exec p4test '"¶m&"'"])
in
Source
in
SQLSource
Then you can click "invoke" button and type a parameter value.
That's all what I've found so far.
- aakgun10 years agoFrequent Visitor
Hi Eric_Zhang,
We could try your steps for using the Stored Procedures with parameters. We could pass the the arguments to the SP but, after each parameters sbmit ans query run, we have gor new dataset result (table).
so we could not use this data in our report as data source.
Is there any option or way to use this SP call with parameters, with refresh of the remaining dataset ?
Any your help or comment is welcome.
Thank you, best regards.
- Eric_Zhang10 years agoMicrosoft Employee
What do you mean "refresh of the remaining dataset", if you dataset is the execution result of an SP, when the passed parameters change, the result set changes accordingly.
- aakgun10 years agoFrequent Visitor
Hello Eric_Zhang,
In Power BI,when we invoke the new Parameter, It executes the SP with parameter but a new dataset table is listed in the Power BI.
I expect that I will have only one data table, (dataset) and SP Execution will refresh its data.