Forum Discussion
AxiomaticOne
Helper I
2 years agoSimple Query using DECLARE with Azure Databricks and Native Query errors, bug?
We are converting data source from Synapse to Databricks. So I'm just tranlating the SQL code and moving over. Came across a problem today where the following code runs just fine in Databricks using ...
Anonymous
2 years agoNot applicable
Hi AxiomaticOne
Please check your connection mode. if your connection mode is direct query, it is not support the declare() in query. it will casue the error.
You can consider to change the connection mode from direct query to import, it can use the declare() and without error.
You can refer to the following similar thread.
Solved: Re: Why is DECLARE not supported (Error)? - Microsoft Fabric Community
Solved: Using SQL statement Source in DirectQuery causes "... - Microsoft Fabric Community
Best Regards!
Yolo Zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- AxiomaticOne2 years ago
Helper I
Direct Query is not the problem I am using import.
- Additional info: This same query runs correctly if connected to a Msft SQL Server connection, but when the connection is changed to Azure Databricks the problem happens.
- Equivelant T-SQL query:
let Source = Sql.Database(Server,Database,[Query = " DECLARE xx INT = 2; SELECT xx; "]) in Source