Is it possible to change SQL statement of the dataset via API call?
My Scenario: I have data in multiple tables in SQL Server. I have created a SQL query with joins to fetch the required data. I created a SQL server dataset by providing that query in the SQL Statement section and published it on the Power BI workspace. Now, I want to modify that SQL Statment programmatically.
Any pointer or help is much appreciated.
Solved! Go to Solution.
Hi @pratikthakor,
>>"use query parameter with t-sql query as optional parameter in sql connector", is there any tutorial or document there to show steps on how to achieve it?
Sure, below is a simple sample, you can test on it.
let tsql=queryparameter,//query parameter is your t-sql string parameter Source= Sql.Database("ServerName", "databaseName", [Query=tsql]) in Source
Reference link:
Regards,
Xiaoxin Sheng
Hi @pratikthakor,
Yes, it is possible to use query parameter with t-sql query as optional parameter in sql connector.
AFAIK, current power bi not support dynamic table structure.(column amount, column name)
So if you change sql query on service side, you need to confirm result table has same structure, otherwise it will return error when refresh data.
Regards,
Xiaoxin Sheng
How can I, "use query parameter with t-sql query as optional parameter in sql connector", is there any tutorial or document there to show steps on how to achieve it?
Hi @pratikthakor,
>>"use query parameter with t-sql query as optional parameter in sql connector", is there any tutorial or document there to show steps on how to achieve it?
Sure, below is a simple sample, you can test on it.
let tsql=queryparameter,//query parameter is your t-sql string parameter Source= Sql.Database("ServerName", "databaseName", [Query=tsql]) in Source
Reference link:
Regards,
Xiaoxin Sheng
Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.
Put your data visualization and design skills to the test! This exciting challenge is happening now through May 31st!
At the monthly call, connect with other leaders and find out how community makes your experience even better.