Forum Discussion
Why is DECLARE not supported (Error)?
- 10 years ago
Hi jsBrizius,
We reproduced same issue as yours. Power BI Desktop will always resolve the front end input SQL statement as a derived table. So when passing the SQL statement, the "Decalare"statement cause syntax error. See the fetched query in SQL profiler:
We have reported this issue internally.
Regards,
I am getting an error when I try to Close & Apply the Query Editor. My query seems to work fine until I try to Close and Apply.
- jsBrizius10 years agoHelper I
So apparently you cannot use DECLARE? I still get the same error with the following query.
- ankitpatira10 years agoCommunity Champion
jsBrizius I can reproduce your issue. But looking at your query you can get away without using Declare. You can instead use each of those functions in line.
- jsBrizius10 years agoHelper I
Is this a bug?
My query is much harder to read without the ability to declare a variable. Seems strange that it works fine in the Query Editor.
- v-sihou-msft10 years agoMicrosoft Employee
Hi jsBrizius,
We reproduced same issue as yours. Power BI Desktop will always resolve the front end input SQL statement as a derived table. So when passing the SQL statement, the "Decalare"statement cause syntax error. See the fetched query in SQL profiler:
We have reported this issue internally.
Regards,